-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Pipeline: no side-effects on model.config
and model.generation_config
🔫
#33480
Conversation
Thanks! The changes make sense to me; I'd like to have @Rocketknight1's opinion as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach makes sense to me! I don't think breaking that dark pattern is too much of a problem.
The only question, though, is whether it would be better to just get rid of those side effects in the pipelines, rather than doing this copy to patch over the problem. Do you know how many pipelines do this?
@Rocketknight1 agreed 🙌 You raised a good question -- in a rush to get the problem solved, I forgot to see the forest from the trees. From a quick check, only pipelines that call As such, instead of doing this copy to patch over the problem, I think we can instead execute the following plan:
WDYT? |
Yes, that sounds good, and a lot cleaner! |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
model.config
and model.generation_config
🔫
@Rocketknight1 v2 is ready for a review 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, LGTM now! I think this approach is way cleaner.
What does this PR do?
Fixes #33398 with two changes (and corresponding regression-preventing tests):
generation_config
. Modifications tomodel.config
ormodel.generation_config
were redirected to the pipeline'sgeneration_config
, and thus avoiding side-effects on the model.PretrainedConfig
from savinggenerate
parameters; Update deprecations ingenerate
-related code 🧹 #32659, we started moving customgenerate
parameterization inmodel.config
tomodel.generation_config
when we calledmodel.save_pretrained()
. When we moved a parameter,model.config
set that parameter toNone
. ThisNone
was not being properly ignored due to the legacy code path (parameterization inmodel.config
takes precedence when the user never explicitly defined aGenerationConfig
). After this PR,None
fields are ignored by the generation config.