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
4cbd876e
Unverified
Commit
4cbd876e
authored
Jan 25, 2024
by
Fanli Lin
Committed by
GitHub
Jan 25, 2024
Browse files
[`Vilt`] align input and model dtype in the ViltPatchEmbeddings forward pass (#28633)
align dtype
parent
24f1a00e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/models/vilt/modeling_vilt.py
src/transformers/models/vilt/modeling_vilt.py
+2
-1
No files found.
src/transformers/models/vilt/modeling_vilt.py
View file @
4cbd876e
...
@@ -317,7 +317,8 @@ class ViltPatchEmbeddings(nn.Module):
...
@@ -317,7 +317,8 @@ class ViltPatchEmbeddings(nn.Module):
raise
ValueError
(
raise
ValueError
(
"Make sure that the channel dimension of the pixel values match with the one set in the configuration."
"Make sure that the channel dimension of the pixel values match with the one set in the configuration."
)
)
x
=
self
.
projection
(
pixel_values
)
target_dtype
=
self
.
projection
.
weight
.
dtype
x
=
self
.
projection
(
pixel_values
.
to
(
dtype
=
target_dtype
))
return
x
return
x
...
...
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