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
bbcd9618
Unverified
Commit
bbcd9618
authored
Dec 28, 2022
by
Joao Gante
Committed by
GitHub
Dec 28, 2022
Browse files
Generate: correctly detect default max length (#20911)
correctly detect default max length
parent
5f9b2ce0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/generation/utils.py
src/transformers/generation/utils.py
+1
-1
No files found.
src/transformers/generation/utils.py
View file @
bbcd9618
...
...
@@ -1215,7 +1215,7 @@ class GenerationMixin:
# 6. Prepare `max_length` depending on other stopping criteria.
input_ids_seq_length
=
input_ids
.
shape
[
-
1
]
has_default_max_length
=
kwargs
.
get
(
"max_length"
)
is
None
and
generation_config
.
max_length
==
20
has_default_max_length
=
kwargs
.
get
(
"max_length"
)
is
None
and
generation_config
.
max_length
is
not
None
if
has_default_max_length
and
generation_config
.
max_new_tokens
is
None
:
warnings
.
warn
(
"Neither `max_length` nor `max_new_tokens` has been set, `max_length` will default to"
...
...
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