[examples] UserWarning: `max_length` is deprecated
See original GitHub issueNot sure how many example scripts are affected by this:
src/transformers/generation_utils.py:963: UserWarning: `max_length` is deprecated in this function, use
`stopping_criteria=StoppingCriteriaList(MaxLengthCriteria(max_length=max_length))` instead.
getting this with at least examples/pytorch/translation/run_translation.py
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
max_length and stopping_criteria in generate() #17718 - GitHub
Accordingly, when you pass max_length you get the deprecated warning, which is ok - however, it recommends using the StoppingCriteriaList ...
Read more >How does max_length, padding and truncation arguments ...
padding=max_length will add a padding of 1 to the third sentence; truncate=True will truncate the first and second sentence so that their length ......
Read more >2101 (maxlength should be max_length) - Django's bug tracker
My personal recommendation would be to add the "max_length" parameter without removing "maxlength." This way, backwards-compatibility can be maintained while ...
Read more >Configuration options for isort
The max length of an import line (used for wrapping long imports). Type: Int ... 6-deprecated-alias-for-5, 7-noqa, 8-vertical-hanging-indent-bracket, ...
Read more >Trainer - Hugging Face
Trainer. The Trainer class provides an API for feature-complete training in PyTorch for most standard use cases. It's used in most of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @stas00 ,
Yes, it’s my fault 1 deprecation too much on the
generate
function ! Just submitted a new PR to remove this extra warnings (which is incorrect).max_length
is used bygenerate
but not by the subsequent functions.Thank you for this investigation, @bhadreshpsavani - that’s very helpful. It looks like the change was introduced just a day before I filed this Issue.
@Narsil, could we please check with you on this deprecation you introduced in https://github.com/huggingface/transformers/commit/aad95c7cdebc24e780e5a5cf39d832c015e40075
max_length
is actively used in the same function:https://github.com/huggingface/transformers/blob/4e7bf94e7280d2b725ac4644dbe9808560afa5d8/src/transformers/generation_utils.py#L919
I am not sure how a deprecated variable is still used normally in the logic…
Also it’s not documented as deprecated:
run_translation.py
andrun_summarization.py
- so if there is a new way could we please atomically adjust all the places that are now impacted by this change? The examples ideally should be in sync with API changes, since their purpose is to correctly demonstrate how to use the library.The main entry point leading to this warning in seq2seq examples is:
https://github.com/huggingface/transformers/blob/4e7bf94e7280d2b725ac4644dbe9808560afa5d8/src/transformers/trainer_seq2seq.py#L161-L171
Thank you!