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
2f16a45d
Unverified
Commit
2f16a45d
authored
Jun 10, 2024
by
Ibrahim Amin
Committed by
GitHub
Jun 10, 2024
Browse files
Use unused prepare_img() function in dinov2 conversion script (#31335)
parent
25245ec2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
src/transformers/models/dinov2/convert_dinov2_to_hf.py
src/transformers/models/dinov2/convert_dinov2_to_hf.py
+2
-3
No files found.
src/transformers/models/dinov2/convert_dinov2_to_hf.py
View file @
2f16a45d
...
...
@@ -138,7 +138,7 @@ def read_in_q_k_v(state_dict, config):
# We will verify our results on an image of cute cats
def
prepare_img
():
url
=
"http://images.cocodataset.org/val2017/000000039769.jpg"
image
=
Image
.
open
(
requests
.
get
(
url
,
stream
=
True
).
raw
)
image
=
Image
.
open
(
requests
.
get
(
url
,
stream
=
True
).
raw
)
.
convert
(
"RGB"
)
return
image
...
...
@@ -190,8 +190,7 @@ def convert_dinov2_checkpoint(model_name, pytorch_dump_folder_path, push_to_hub=
model
.
load_state_dict
(
state_dict
)
# load image
url
=
"http://images.cocodataset.org/val2017/000000039769.jpg"
image
=
Image
.
open
(
requests
.
get
(
url
,
stream
=
True
).
raw
).
convert
(
"RGB"
)
image
=
prepare_img
()
# preprocess image
transformations
=
transforms
.
Compose
(
...
...
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