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

Fix ConvNext V2 parameter naming issue #23122

Merged
merged 2 commits into from
May 3, 2023

Conversation

alaradirik
Copy link
Contributor

@alaradirik alaradirik commented May 3, 2023

What does this PR do?

Renames gamma and beta parameters of the ConvNextV2GRN module, which caused the save_pretrained method to rename these parameters to weight and bias.

Existing checkpoints on the hub can be loaded without any warnings once the PR is merged.

Fixes #23090

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • [X ] Did you read the contributor guideline,
    Pull Request section?
  • [X ] Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 3, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

Comment on lines +102 to +105
if "gamma" in name:
name = name.replace("gamma", "weight")
if "beta" in name:
name = name.replace("beta", "bias")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to do it since from_pretrained will do it anyway. But it doesn't hurt I guess 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah true, I renamed them differently at first and then switched to weight and bias to avoid updating the checkpoints

Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks for fixing! 🔧

@alaradirik alaradirik merged commit 56b8d49 into huggingface:main May 3, 2023
4 checks passed
@alaradirik alaradirik changed the title Fix ConvNext V2 paramater naming issue Fix ConvNext V2 parameter naming issue May 3, 2023
qywu pushed a commit to qywu/transformers that referenced this pull request May 3, 2023
Fixes the parameter naming issue in ConvNextV2GRN module
gojiteji pushed a commit to gojiteji/transformers that referenced this pull request Jun 5, 2023
Fixes the parameter naming issue in ConvNextV2GRN module
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
Fixes the parameter naming issue in ConvNextV2GRN module
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.

ConvNextV2 weight not initialized
4 participants