Del ort_model._modules to foward its accessing to torch_model._modules#14563
Merged
guyang3532 merged 1 commit intomicrosoft:mainfrom Mar 3, 2023
Merged
Del ort_model._modules to foward its accessing to torch_model._modules#14563guyang3532 merged 1 commit intomicrosoft:mainfrom
guyang3532 merged 1 commit intomicrosoft:mainfrom
Conversation
Contributor
Author
|
I think a better solution should be forwarding the access of ORTModule._modules to TorchModule._modules to keep consistent rather than just copying it. But I have not figured out a good implementation. Do you have any suggestion? @baijumeswani @pengwa |
baijumeswani
reviewed
Feb 3, 2023
Contributor
|
|
74388e9 to
0d46c2a
Compare
Contributor
Author
As you described in #7847, because load_state_dict does not recursively call load_state_dict on its children, but instead it defines its own function load (inside load_state_dict) which does this task. |
baijumeswani
previously approved these changes
Feb 7, 2023
baijumeswani
previously approved these changes
Feb 11, 2023
baijumeswani
approved these changes
Feb 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
General Description
Missing '_modules' attribute in ORTModule will cause load_state_dict for wrapped_ortmodule fail.
The ut of 'test_load_state_dict_for_wrapped_ortmodule' has not catch this problem is because it didn't copy the state_dict
and the two state_dicts shared the same memory.
Motivation and Context
reference:#7847