-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MT5ForConditionalGeneration has model.config.max_length=20 by default. Why? #16664
Comments
Hi @JoaoLages 👋 Tagging @patrickvonplaten for the discussion. Context for this discussion: We have had similar problems in the past, related to a small default The issue is a double-edged sword. With no default, we risk generating beyond the model's input size, which may be undesirable. If we set I agree that the current state is not good enough, but increasing the default Alternatively, we can increase the default to the model's input size, and rely on early stopping to ensure generation does not drag for long by default -- WDYT @patrickvonplaten? (we could add a tqdm-like progress bar so users don't think the process died) |
I still think it's best to always have |
Sadly we cannot change this default anymore due to backward compatibility. Always having the model generate up to maximum allowed tokens can also be tricky - multiple models will always error out due to memory, some models like T5 have no max length really, ... so think we'll have to leave it at 20. Maybe we can improve the docs somehow |
I have the idea that no one is using early stopping in these models because 'it doesn't work' and it is due to this silent behaviour 😅 |
These legacy choices are painful, but changing them also causes many issues for downstream users 💔 @JoaoLages I've added three actions points for me:
Is there anything else you believe we can do to improve |
Not really, |
(going to keep the issue open to backlink in a future improved logging PR) |
People that are familiar with |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
transformers
version: 4.6.1I spent one week training a T5 model with this package and couldn't figure out why my sequences obtained with Trainer.evaluate were only yielding a maximum of 20 tokens. I sent the
max_length
argument to the tokenizer to encode the input/output.After a long time I found out that this happens:
The generate method was being used in Trainer because I used
predict_with_generate=True
.Please change this behaviour, this was a very hard bug to find.
model.config.max_length
should be set toNone
by default, if the model does not have limitations.The text was updated successfully, but these errors were encountered: