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
47489a69
Unverified
Commit
47489a69
authored
Oct 15, 2021
by
Murilo Gonçalves
Committed by
GitHub
Oct 15, 2021
Browse files
Fix: replace asserts statements with exception (#14029)
parent
cd3166a8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
src/transformers/models/lxmert/modeling_lxmert.py
src/transformers/models/lxmert/modeling_lxmert.py
+4
-2
No files found.
src/transformers/models/lxmert/modeling_lxmert.py
View file @
47489a69
...
@@ -935,8 +935,10 @@ class LxmertModel(LxmertPreTrainedModel):
...
@@ -935,8 +935,10 @@ class LxmertModel(LxmertPreTrainedModel):
else
:
else
:
raise
ValueError
(
"You have to specify either input_ids or inputs_embeds"
)
raise
ValueError
(
"You have to specify either input_ids or inputs_embeds"
)
assert
visual_feats
is
not
None
,
"`visual_feats` cannot be `None`"
if
visual_feats
is
None
:
assert
visual_pos
is
not
None
,
"`visual_pos` cannot be `None`"
raise
ValueError
(
"`visual_feats` cannot be `None`"
)
if
visual_pos
is
None
:
raise
ValueError
(
"`visual_pos` cannot be `None`"
)
device
=
input_ids
.
device
if
input_ids
is
not
None
else
inputs_embeds
.
device
device
=
input_ids
.
device
if
input_ids
is
not
None
else
inputs_embeds
.
device
...
...
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