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
chenych
MML_pytorch
Commits
9e4126a0
Commit
9e4126a0
authored
Dec 23, 2023
by
chenych
Browse files
add .float()
parent
88df767f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
beit3/utils.py
beit3/utils.py
+9
-9
No files found.
beit3/utils.py
View file @
9e4126a0
...
...
@@ -571,7 +571,7 @@ def load_model_and_may_interpolate(ckpt_path, model, model_key, model_prefix):
extra_tokens
=
pos_embed_checkpoint
[:,
:
num_extra_tokens
]
# only the position tokens are interpolated
pos_tokens
=
pos_embed_checkpoint
[:,
num_extra_tokens
:]
pos_tokens
=
pos_tokens
.
reshape
(
-
1
,
orig_size
,
orig_size
,
embedding_size
).
permute
(
0
,
3
,
1
,
2
)
pos_tokens
=
pos_tokens
.
reshape
(
-
1
,
orig_size
,
orig_size
,
embedding_size
).
permute
(
0
,
3
,
1
,
2
)
.
float
()
pos_tokens
=
torch
.
nn
.
functional
.
interpolate
(
pos_tokens
,
size
=
(
new_size
,
new_size
),
mode
=
'bicubic'
,
align_corners
=
False
)
pos_tokens
=
pos_tokens
.
permute
(
0
,
2
,
3
,
1
).
flatten
(
1
,
2
)
...
...
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