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
[fx] GraphModule copy top level attributes from root #45182
Conversation
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: c9a0c7f570b44e99a83e46ccdc5e90139966ad70 Pull Request resolved: #45182
💊 CI failures summary and remediationsAs of commit cd94987 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 16 times. |
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23858632](https://our.internmc.facebook.com/intern/diff/D23858632) [ghstack-poisoned]
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 3466ebdd4cafbca5ed305618307d6fb09b36fd89 Pull Request resolved: #45182
Codecov Report
@@ Coverage Diff @@
## gh/jerryzh168/439/base #45182 +/- ##
=======================================================
Coverage 68.10% 68.11%
=======================================================
Files 393 393
Lines 50945 50953 +8
=======================================================
+ Hits 34698 34707 +9
+ Misses 16247 16246 -1
Continue to review full report at Codecov.
|
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23858632](https://our.internmc.facebook.com/intern/diff/D23858632) [ghstack-poisoned]
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23858632](https://our.internmc.facebook.com/intern/diff/D23858632) [ghstack-poisoned]
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D23858632](https://our.internmc.facebook.com/intern/diff/D23858632) [ghstack-poisoned]
Summary: Previously only the attributes that's used in the graph is copied in the constructor of GraphModule, this PR adds the support for copying all attributes by overriding `__dict__` Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: df0b0b99545320553100d787c4b81f053565b291 Pull Request resolved: #45182
return GraphModule(fake_mod, self.graph) | ||
graph_module = GraphModule(fake_mod, self.graph) | ||
# skip overwriting generated attributes | ||
for attr in ['code', '_graph', '_modules']: |
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.
These fields are not complete. For instance _parameters
and _buffers
are not included and copying them might break the nn.Module similar to _modules
. Any attempt to list parameters here would be very fragile because changes to nn.Module
would affect what this list needs to be with no reliable way to inform an editor of nn.Module that this list also needs to be modified.
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.
actually I'm not sure why I included _modules
we probably don't need that. This is just for skipping attributes generated when creating a GraphModule.
fixed in the original PR: #44074 |
Stack from ghstack:
Summary:
Previously only the attributes that's used in the graph is copied in the constructor
of GraphModule, this PR adds the support for copying all attributes by overriding
__dict__
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D23858632