Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
b513ec8b
Unverified
Commit
b513ec8b
authored
Dec 21, 2021
by
Patrick von Platen
Committed by
GitHub
Dec 21, 2021
Browse files
[Bart] better error message (#14854)
parent
7af80f66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
src/transformers/models/bart/modeling_bart.py
src/transformers/models/bart/modeling_bart.py
+7
-0
src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
...ormers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
+7
-0
No files found.
src/transformers/models/bart/modeling_bart.py
View file @
b513ec8b
...
...
@@ -1171,6 +1171,13 @@ class BartModel(BartPretrainedModel):
# different to other models, Bart automatically creates decoder_input_ids from
# input_ids if no decoder_input_ids are provided
if
decoder_input_ids
is
None
and
decoder_inputs_embeds
is
None
:
if
input_ids
is
None
:
raise
ValueError
(
"If no `decoder_input_ids` or `decoder_inputs_embeds` are "
"passed, `input_ids` cannot be `None`. Please pass either "
"`input_ids` or `decoder_input_ids` or `decoder_inputs_embeds`."
)
decoder_input_ids
=
shift_tokens_right
(
input_ids
,
self
.
config
.
pad_token_id
,
self
.
config
.
decoder_start_token_id
)
...
...
src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
View file @
b513ec8b
...
...
@@ -2369,6 +2369,13 @@ class BigBirdPegasusModel(BigBirdPegasusPreTrainedModel):
# different to other models, BigBirdPegasus automatically creates decoder_input_ids from
# input_ids if no decoder_input_ids are provided
if
decoder_input_ids
is
None
and
decoder_inputs_embeds
is
None
:
if
input_ids
is
None
:
raise
ValueError
(
"If no `decoder_input_ids` or `decoder_inputs_embeds` are "
"passed, `input_ids` cannot be `None`. Please pass either "
"`input_ids` or `decoder_input_ids` or `decoder_inputs_embeds`."
)
decoder_input_ids
=
shift_tokens_right
(
input_ids
,
self
.
config
.
pad_token_id
,
self
.
config
.
decoder_start_token_id
)
...
...
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