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
3a7f5fa9
Unverified
Commit
3a7f5fa9
authored
Mar 24, 2023
by
Samuel Bubán
Committed by
GitHub
Mar 24, 2023
Browse files
Improve error message (#22361)
* Improve error message * Fix consistency
parent
6587125c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
src/transformers/models/vit/modeling_vit.py
src/transformers/models/vit/modeling_vit.py
+1
-0
src/transformers/models/vit_msn/modeling_vit_msn.py
src/transformers/models/vit_msn/modeling_vit_msn.py
+1
-0
No files found.
src/transformers/models/vit/modeling_vit.py
View file @
3a7f5fa9
...
@@ -170,6 +170,7 @@ class ViTPatchEmbeddings(nn.Module):
...
@@ -170,6 +170,7 @@ class ViTPatchEmbeddings(nn.Module):
if
num_channels
!=
self
.
num_channels
:
if
num_channels
!=
self
.
num_channels
:
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."
f
" Expected
{
self
.
num_channels
}
but got
{
num_channels
}
."
)
)
if
not
interpolate_pos_encoding
:
if
not
interpolate_pos_encoding
:
if
height
!=
self
.
image_size
[
0
]
or
width
!=
self
.
image_size
[
1
]:
if
height
!=
self
.
image_size
[
0
]
or
width
!=
self
.
image_size
[
1
]:
...
...
src/transformers/models/vit_msn/modeling_vit_msn.py
View file @
3a7f5fa9
...
@@ -153,6 +153,7 @@ class ViTMSNPatchEmbeddings(nn.Module):
...
@@ -153,6 +153,7 @@ class ViTMSNPatchEmbeddings(nn.Module):
if
num_channels
!=
self
.
num_channels
:
if
num_channels
!=
self
.
num_channels
:
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."
f
" Expected
{
self
.
num_channels
}
but got
{
num_channels
}
."
)
)
if
not
interpolate_pos_encoding
:
if
not
interpolate_pos_encoding
:
if
height
!=
self
.
image_size
[
0
]
or
width
!=
self
.
image_size
[
1
]:
if
height
!=
self
.
image_size
[
0
]
or
width
!=
self
.
image_size
[
1
]:
...
...
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