-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[JIT] Add support for named_modules() #29495
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
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]
| 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
zdevito
left a comment
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]
…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]
…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:
|
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]
driazati
left a comment
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]
…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