Skip to content

Conversation

@amyeroberts
Copy link
Contributor

@amyeroberts amyeroberts commented Jun 6, 2022

What does this PR do?

Add two weight name mappings for PyTorch -> TensorFlow necessary for cross-loading weights for batchnorm layers which have been trained with tracking_running_stats=True.

This was necessary for cross-loading weights for the ResNet and RegNet ports. #17536 , #17554

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • 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?
    NB. I couldn't find tests corresponding to the current weight loading logic.

Who can review?

Anyone in the community is free to review the PR once the tests have passed.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 6, 2022

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

@amyeroberts amyeroberts requested review from sgugger and thomwolf June 6, 2022 16:38
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 a lot for diving into this. I would very very very much prefer if we could that rename in the functions that change the weights (and maybe reshape) as this renaming gamma/beta has been a huge pain in the butt for many contributors (and we actually wanted to get rid of it when we find a way to make it in a BC fashion).

@amyeroberts
Copy link
Contributor Author

Closing as the change was added in this PR :#17271

@sgugger I'll open a follow-up PR to address your comments.

@amyeroberts amyeroberts closed this Jun 9, 2022
@amyeroberts amyeroberts deleted the add-batchnorm-running-calc-weight-to-porting-script branch June 9, 2022 13:57
@sgugger
Copy link
Collaborator

sgugger commented Jun 9, 2022

Actually, I misread the file where it's modified 😅
It's fine for the conversion like this, it's the code in modeling_utils that does this I don't want (like here). Sorry I didn't pay close enough attention.

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.

3 participants