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
[JIT] Add support for named_modules() #29495
Conversation
[ghstack-poisoned]
…quential" This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for #28998 [ghstack-poisoned]
ghstack-source-id: 5329963937c5622a691a9573bb95bac9597cc4af Pull Request resolved: #29495
iterator->addChild(loc, m, modules_); | ||
return std::make_shared<ModuleDictMethod>(iterator, "items"); | ||
} else { | ||
throw ErrorReport(loc) << "_Modules only supports keys, values, or items"; |
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.
_Modules
-> _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.
Binding a private python member into TorchScript seems like the wrong approach. Shouldn't we implement the standard nn.Module API for this stuff? That would be the children
, named_children
, modules()
and named_modules
methods. Having _modules
without named_children
is going to promote the use of a private API.
…quential" This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for #28998 Differential Revision: [D18412561](https://our.internmc.facebook.com/intern/diff/D18412561) [ghstack-poisoned]
ghstack-source-id: 3a48515779883739cacde1f244d474884cfebc88 Pull Request resolved: #29495
…quential" This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for #28998 Differential Revision: [D18412561](https://our.internmc.facebook.com/intern/diff/D18412561) [ghstack-poisoned]
…quential" This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for #28998 Differential Revision: [D18412561](https://our.internmc.facebook.com/intern/diff/D18412561) [ghstack-poisoned]
ghstack-source-id: 90941b7813c3f03ca0a63755cc42f6da9f32bf81 Pull Request resolved: #29495
…quential" This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for #28998 Differential Revision: [D18412561](https://our.internmc.facebook.com/intern/diff/D18412561) [ghstack-poisoned]
💊 CircleCI build failures summary and remediationsAs of commit 01e28fe:
Detailed failure analysisOne may explore the probable reasons each build failed interactively on the Dr. CI website. 🕵️ 1 new failure recognized by patternsThe following build failures do not appear to be due to upstream breakage: pytorch_linux_xenial_py3_6_gcc5_4_build (1/1)Step: "Build" (full log | pattern match details)
|
no longer exposing internal api, now exposing named_modules()
This doesn't do the checking for uniqueness, but when we recursively script we create a new module on each compilation (don't preserve aliasing), so i don't think that's actually a problem. |
Fix for #28998 Differential Revision: [D18412561](https://our.internmc.facebook.com/intern/diff/D18412561) [ghstack-poisoned]
ghstack-source-id: 0bc3f1a98042f67c41baae297d4ff70d55a07bc7 Pull Request resolved: #29495
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.
Can you make a follow up issue or add to this PR stuff like named_children
?
i'm going to do the other apis as a follow up sometime this week. |
Fix for #28998 Differential Revision: [D18412561](https://our.internmc.facebook.com/intern/diff/D18412561) [ghstack-poisoned]
ghstack-source-id: 488beb0a820c3b7cd3e4f09443e849aed4f4ba39 Pull Request resolved: #29495
…29495) Summary: Pull Request resolved: #29495 This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for #28998 Test Plan: Imported from OSS Differential Revision: D18412561 Pulled By: eellison fbshipit-source-id: a8b24ebee39638fccf63b2701f65f8bb0de84faa
…ytorch#29495) Summary: Pull Request resolved: pytorch#29495 This PR adds support for `_modules`, making it so we no longer need to special case support for `nn.Sequential`. I was getting internal errors around the previous approach using `self.define()`, so i am adding this PR as part of the stack. Fix for pytorch#28998 Test Plan: Imported from OSS Differential Revision: D18412561 Pulled By: eellison fbshipit-source-id: a8b24ebee39638fccf63b2701f65f8bb0de84faa
Stack from ghstack:
Fix for #28998
Differential Revision: D18412561