-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Silent failure in generation parameters #33690
Comments
cc @gante |
Hey! Actually these are validated when preparing generation config in But seems like we don't check all generation parameters and perform general check on whether there isn't any clash between kwargs. @gante will say if we need to perform check on everything or not :) |
Thank you @zucchini-nlp for the clarification, from what I can see it looks like the It would be great to hear @gante's thoughts on whether we should validate all parameters upfront, perhaps, this could happen in I'm happy to assist with a PR if needed! |
@Manalelaidouni the config validates that incoming params are correct when updating, but the validation is done on a general level. So that we don;t have clashing arguments as generation without sampling but with a top-k param |
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. |
Hi @Manalelaidouni 👋 Yes, more validation is super welcome! :D We should, in fact, create bulk validation structures, such as:
(note: we don't want to add pydantic as a dependency :) ) |
Got it, I’ve opened a PR with your suggestions @gante, if there’s any advanced validation testing you have in mind I’m happy to implement it! 😊 |
System Info
transformers
version: 4.44.2Who can help?
@zucchini-nlp @gante
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Hey!
I noticed that
top_p
was silenctly failing so I tested the rest of the generation parameters and found thatno_repeat_ngram_size
also silently fails for the same reason: the condition checks inside of the_get_logits_processor()
method prevent their respective wrapper classes from executing, which is where the ValueError are being raised.For instance,
raise ValueError(f"`ngram_size` has to be a strictly positive integer, but is {ngram_size}")
error is never reached when we setno_repeat_ngram_size <= 0
.Here is a simple example with the invalid values where generation proceeds without notifying the user. Ideally, those should raise errors or warnings.
Expected behavior
To not let things fail silently and proceed with a default value, instead raise a ValueError or issue a warning to the user.
It would be great if the
generate
method could fail early when invalid values are passed, maybe by checking for them upfront in_get_logits_processor
before applying the generation parameters one by one and going through the entire process, this will help avoid wasting compute resources.I would be happy to open a PR to help address this issue if that’s possible, thank you for all your work!
The text was updated successfully, but these errors were encountered: