-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Preserve hub-related kwargs in AutoModel.from_pretrained #18545
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
| elif "model_type" in config_dict: | ||
| config_class = CONFIG_MAPPING[config_dict["model_type"]] | ||
| return config_class.from_dict(config_dict, **kwargs) | ||
| return config_class.from_dict(config_dict, **unused_kwargs) |
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.
We replicate the logic inside from_pretrained here, but duplicating some of the kwargs.
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.
Sounds good
LysandreJik
left a comment
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 looks good, quite elegant! Thanks for catching and patching the issue.
| elif "model_type" in config_dict: | ||
| config_class = CONFIG_MAPPING[config_dict["model_type"]] | ||
| return config_class.from_dict(config_dict, **kwargs) | ||
| return config_class.from_dict(config_dict, **unused_kwargs) |
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.
Sounds good
What does this PR do?
As was reported in #18537, when using
AutoConfiginside theAutoModel.from_pretrainedmethod, some kwargs are deleted and not passed to thefrom_pretrainedmethod of the model. This PR makes sure they are preserved for those calls.Fixes #18537