Pipeline: no side-effects on model.config and model.generation_config 🔫 #33480
Pipeline: no side-effects on model.config and model.generation_config 🔫 #33480gante merged 7 commits intohuggingface:mainfrom
model.config and model.generation_config 🔫 #33480Conversation
|
Thanks! The changes make sense to me; I'd like to have @Rocketknight1's opinion as well |
Rocketknight1
left a comment
There was a problem hiding this comment.
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 🤗 |
Rocketknight1
left a comment
There was a problem hiding this comment.
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.configormodel.generation_configwere redirected to the pipeline'sgeneration_config, and thus avoiding side-effects on the model.PretrainedConfigfrom savinggenerateparameters; Update deprecations ingenerate-related code 🧹 #32659, we started moving customgenerateparameterization inmodel.configtomodel.generation_configwhen we calledmodel.save_pretrained(). When we moved a parameter,model.configset that parameter toNone. ThisNonewas not being properly ignored due to the legacy code path (parameterization inmodel.configtakes precedence when the user never explicitly defined aGenerationConfig). After this PR,Nonefields are ignored by the generation config.