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
738944c9
Unverified
Commit
738944c9
authored
Mar 27, 2023
by
Joao Gante
Committed by
GitHub
Mar 27, 2023
Browse files
Trainer: missing None check (#22404)
missing None check
parent
53155b52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/trainer_seq2seq.py
src/transformers/trainer_seq2seq.py
+1
-1
No files found.
src/transformers/trainer_seq2seq.py
View file @
738944c9
...
...
@@ -281,7 +281,7 @@ class Seq2SeqTrainer(Trainer):
# in case the batch is shorter than max length, the output should be padded
if
generated_tokens
.
shape
[
-
1
]
<
gen_config
.
max_length
:
generated_tokens
=
self
.
_pad_tensors_to_max_len
(
generated_tokens
,
gen_config
.
max_length
)
elif
generated_tokens
.
shape
[
-
1
]
<
gen_config
.
max_new_tokens
+
1
:
elif
gen_config
.
max_new_tokens
is
not
None
and
generated_tokens
.
shape
[
-
1
]
<
gen_config
.
max_new_tokens
+
1
:
generated_tokens
=
self
.
_pad_tensors_to_max_len
(
generated_tokens
,
gen_config
.
max_new_tokens
+
1
)
with
torch
.
no_grad
():
...
...
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