Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
85e9d644
Unverified
Commit
85e9d644
authored
Oct 17, 2023
by
Shinji Yamada
Committed by
GitHub
Oct 17, 2023
Browse files
fix: when window_size is passes as array (#26800)
parent
b3961f72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
src/transformers/models/swinv2/modeling_swinv2.py
src/transformers/models/swinv2/modeling_swinv2.py
+6
-1
No files found.
src/transformers/models/swinv2/modeling_swinv2.py
View file @
85e9d644
...
...
@@ -791,6 +791,11 @@ class Swinv2Stage(nn.Module):
super
().
__init__
()
self
.
config
=
config
self
.
dim
=
dim
window_size
=
(
config
.
window_size
if
isinstance
(
config
.
window_size
,
collections
.
abc
.
Iterable
)
else
(
config
.
window_size
,
config
.
window_size
)
)
self
.
blocks
=
nn
.
ModuleList
(
[
Swinv2Layer
(
...
...
@@ -798,7 +803,7 @@ class Swinv2Stage(nn.Module):
dim
=
dim
,
input_resolution
=
input_resolution
,
num_heads
=
num_heads
,
shift_size
=
0
if
(
i
%
2
==
0
)
else
config
.
window_size
//
2
,
shift_size
=
[
0
,
0
]
if
(
i
%
2
==
0
)
else
[
window_size
[
0
]
//
2
,
window_size
[
1
]
//
2
]
,
pretrained_window_size
=
pretrained_window_size
,
)
for
i
in
range
(
depth
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment