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
86ffef87
Unverified
Commit
86ffef87
authored
Sep 13, 2023
by
Joao Gante
Committed by
GitHub
Sep 13, 2023
Browse files
Generate: ignore warning when `generation_config.max_length` is set to `None` (#26147)
parent
a6ae2bd0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
src/transformers/generation/flax_utils.py
src/transformers/generation/flax_utils.py
+1
-1
src/transformers/generation/tf_utils.py
src/transformers/generation/tf_utils.py
+1
-1
src/transformers/generation/utils.py
src/transformers/generation/utils.py
+1
-1
No files found.
src/transformers/generation/flax_utils.py
View file @
86ffef87
...
...
@@ -389,7 +389,7 @@ class FlaxGenerationMixin:
UserWarning
,
)
elif
generation_config
.
max_new_tokens
is
not
None
:
if
not
has_default_max_length
:
if
not
has_default_max_length
and
generation_config
.
max_length
is
not
None
:
logger
.
warning
(
f
"Both `max_new_tokens` (=
{
generation_config
.
max_new_tokens
}
) and `max_length`(="
f
"
{
generation_config
.
max_length
}
) seem to have been set. `max_new_tokens` will take precedence. "
...
...
src/transformers/generation/tf_utils.py
View file @
86ffef87
...
...
@@ -841,7 +841,7 @@ class TFGenerationMixin:
UserWarning
,
)
elif
generation_config
.
max_new_tokens
is
not
None
:
if
not
has_default_max_length
:
if
not
has_default_max_length
and
generation_config
.
max_length
is
not
None
:
logger
.
warning
(
f
"Both `max_new_tokens` (=
{
generation_config
.
max_new_tokens
}
) and `max_length`(="
f
"
{
generation_config
.
max_length
}
) seem to have been set. `max_new_tokens` will take precedence. "
...
...
src/transformers/generation/utils.py
View file @
86ffef87
...
...
@@ -1517,7 +1517,7 @@ class GenerationMixin:
input_ids_length
=
input_ids
.
shape
[
-
1
]
has_default_max_length
=
kwargs
.
get
(
"max_length"
)
is
None
and
generation_config
.
max_length
is
not
None
if
generation_config
.
max_new_tokens
is
not
None
:
if
not
has_default_max_length
:
if
not
has_default_max_length
and
generation_config
.
max_length
is
not
None
:
logger
.
warning
(
f
"Both `max_new_tokens` (=
{
generation_config
.
max_new_tokens
}
) and `max_length`(="
f
"
{
generation_config
.
max_length
}
) seem to have been set. `max_new_tokens` will take precedence. "
...
...
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