Skip to content
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

Config: lower save_pretrained exception to warning #33906

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

gante
Copy link
Member

@gante gante commented Oct 3, 2024

What does this PR do?

Round 2, after #33886 -- TL;DR stops raising exceptions when saving a model config with generative parameters, if the user is not responsible for those parameters being there.

(copied from 33886)

In a recent PR (https://github.com/huggingface/transformers/pull/32659), we started raising exceptions if we were to store a model config with generative parameters. If we were saving a model, which saves the config, the generative parameters were moved to GenerationConfig before saving the PreTrainedConfig, working around the issue when saving a model.

However, a common use case was uncovered. If a user loads a PreTrainedConfig with generative parameters and tries to save it, the user has done nothing wrong and yet they see an exception. This PR lowers the exception to a warning in that situation, preventing the code from crashing :)

33886 would be my intended solution to the problem, but I ran into multiple implementation issues which I'll iron out in separate PRs 👀 This PR is a poor man's version of the solution, to unblock others: simply lower the exception to a warning.

(cc @regisss )

@gante gante requested a review from LysandreJik October 3, 2024 09:59
@HuggingFaceDocBuilderDev

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.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

@regisss
Copy link
Contributor

regisss commented Oct 3, 2024

Thanks for the fix Joao!

@gante gante merged commit b0c5660 into huggingface:main Oct 3, 2024
24 checks passed
@gante gante deleted the lower_to_warning branch October 3, 2024 15:45
ArthurZucker pushed a commit that referenced this pull request Oct 7, 2024
* lower to warning

* msg

* make fixup

* rm extra comma
NielsRogge pushed a commit to NielsRogge/transformers that referenced this pull request Oct 21, 2024
* lower to warning

* msg

* make fixup

* rm extra comma
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* lower to warning

* msg

* make fixup

* rm extra comma
BernardZach pushed a commit to innovationcore/transformers that referenced this pull request Dec 6, 2024
* lower to warning

* msg

* make fixup

* rm extra comma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants