-
Notifications
You must be signed in to change notification settings - Fork 554
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
[PyTorchModelHubMixin] Fix saving model with shared tensors #2086
Conversation
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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2086 +/- ##
==========================================
+ Coverage 82.90% 82.92% +0.02%
==========================================
Files 102 102
Lines 9480 9477 -3
==========================================
Hits 7859 7859
+ Misses 1621 1618 -3 ☔ View full report in Codecov by Sentry. |
Thanks for the PR @NielsRogge. I've added a test + used Regarding |
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.
Let's get this merged :)
* Use save_model * Use model * add tests + comments + load_model * move to device --------- Co-authored-by: Lucain Pouget <lucainp@gmail.com>
This PR uses
save_model
instead ofsave_file
in order to properly save shared tensors for thePyTorchModelHubMixin
.In the future, this may be replaced by save_file again when we support saving sharded checkpoints, which deduplicates shared tensors as in the Transformers library.