Unverified Commit 3a7f5fa9 authored by Samuel Bubán's avatar Samuel Bubán Committed by GitHub
Browse files

Improve error message (#22361)

* Improve error message

* Fix consistency
parent 6587125c
...@@ -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]:
......
...@@ -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]:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment