-
Notifications
You must be signed in to change notification settings - Fork 429
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
Save metadata and integration when save_weights_only is set #2396
Conversation
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.
What if we always included these in the weights only option? I'm just a little hesitant to add more trainer args...
@mvpatel2000 the issue with always including metadata is that its kind of an API change. If there is code out there relying on a weights only checkpoint only having one key. That being said, it may be worth making that change, not sure. But I think this is the right implementation given that. At a later date we will remove this flag and make it the default |
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.
LGTM pending the resolution of Mihir's comment
@mvpatel2000, @dakinggg, ok fixed to add metadata saving to the save_weights_only option |
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.
Lgtm! Minor comment that we should probably avoid a warnings.warn in this case.
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.
Lgtm thanks for taking care of this
Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>
What does this PR do?
When
save_weights_only
is specified to the Trainer, only the weights are saved and no metadata or integrations are saved. However, when doing inference it is often necessary to have the metadata along with the weights. The only current way to get metadata and integrations is to save everything in the state_dict (including the very large optimizer state). This PR enables saving the weights and the metadata and integrations, so you can save an inference-friendly checkpoint without the extra heft of the optimizer or other (not necessary for inference) state fields.What issue(s) does this change relate to?
fix CO-2226