Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Train] Strip "module." from state dict #30705
[Train] Strip "module." from state dict #30705
Changes from all commits
80bec0b
6fdb633
d2bc55d
fe91373
84e4d4d
b931c2c
9149677
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
for my understanding, can you elaborate on why prepare_model causes this test to fail?
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.
prepare_model
will wrap the model in DDP. If the user doesn't manually unwrap it before saving, DDP will throw an exception after being loaded.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.
sorry I guess I mean more- why is it not going through the _encode_dict path?
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.
If a checkpoint is created from directory, we aren't really able to detect what's actually in the files without deserializing them in the first place (which would not only add overhead but also cause the error anyway), and we can't apply
_encode_dict
on already serialized dataThere 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.
then for this dir checkpoint, why does it get deserialized in the first place?
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.
Well, we don't have a native way of supporting torch models from files (as mentioned by the TODO in this test). Therefore, the test implements its own predictor. Using dir checkpoints with torch is not what we want users to do right now, but the purpose of this test is to make sure that it works regardless.
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.
We can add prepare_model here but we'd have to unwrap the model before saving anyway, meaning we wouldn't really test anything extra here.