Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[from_pretrained] refactor find_mismatched_keys #16706

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

stas00
Copy link
Contributor

@stas00 stas00 commented Apr 11, 2022

This PR refactors 2 large identical code copies introduced by the recent sharded checkpoint PR into a helper function which is then called from 2 places. There is no change in functionality.

It's an intermediary step for this PR: #16657 which revamps low_cpu_mem_usage and integrates it better with the sharded checkpoint code branch.

I explained here why the helper function is not a closure but needs the input args explicitly: #16657 (comment)

@sgugger

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 11, 2022

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 a lot for fragmenting. Let's way for @LysandreJik and @patrickvonplaten to approve as well before merging, as it's really core functionality and I would like one more set of eyes on it.

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.

Looks good to me, thanks for your work @stas00

Copy link
Contributor

@patrickvonplaten patrickvonplaten 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 the clean-up! The code snippets are identical so great to refactor it here

@sgugger sgugger merged commit 12bfa97 into main Apr 13, 2022
@sgugger sgugger deleted the from_pretrained_find_mismatched_keys branch April 13, 2022 11:50
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants