-
Notifications
You must be signed in to change notification settings - Fork 25k
[RPC] Create local RRef<ModuleInterface> remotely in Python, use it remotely in TorchScript #34183
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
` Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
` Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) ghstack-source-id: 99451392 Pull Request resolved: #34183
💊 CircleCI build failures summary and remediationsAs of commit 1da85ab (more details on the Dr. CI page): Commit 1da85ab was recently pushed. Waiting for builds... 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. This comment has been revised 22 times. |
…rchScript" ` Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
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.
Q: Can you add a test again "torchscript class interface"? not sure if this is the correct name, but the code is something like this
@torch.jit.interface
class Interface(object):
…rchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to track the type of the `ScriptModule` it holds.. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more helpful to mark it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
Pull Request resolved: #34183 #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to track the type of the `ScriptModule` it holds.. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more helpful to mark it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. ghstack-source-id: 99536698 Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/)
…it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
… in TorchScript Pull Request resolved: #34183 #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. ghstack-source-id: 99563605 Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/)
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.
LGTM! Thanks for adding this!
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.
There're several type check/ user facing error message we should fix before we merge this.
…it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
…it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
…it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
… in TorchScript Pull Request resolved: #34183 #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. ghstack-source-id: 99619039 Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/)
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.
looking good, some nits and some questions.
…it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
… in TorchScript Pull Request resolved: #34183 #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. ghstack-source-id: 99630694 Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/)
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.
looks good! one minor suggestion on merging two checks.
…it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
… in TorchScript Pull Request resolved: #34183 #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. ghstack-source-id: 99648617 Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/)
…n, use it remotely in TorchScript" #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to set an `RRef` for what `ModuleInterface` type it's holds. Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/) [ghstack-poisoned]
…emotely in TorchScript Pull Request resolved: #34183 #33263 enhanced the RRef Python constructor to infer most types, by `jit::tryToInferType(..)`. But this helper function can't infer `ScriptModule` type due to `ScriptModule`'s special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's contained `ScriptModule`. Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified `ModuleInterface` type. We added an optional argument `type_hint` for users to mark an `RRef` for what `ModuleInterface` type it's holds. ghstack-source-id: 99649379 Differential Revision: [D7065050](https://our.internmc.facebook.com/intern/diff/D7065050/)
This pull request has been merged in 17ceb69. |
Stack from ghstack:
#33263 enhanced the RRef Python constructor to infer most types, by
jit::tryToInferType(..)
.But this helper function can't infer
ScriptModule
type due toScriptModule
's special per-Module type singleton logic, so it's still not possible for an Python-created RRef to know the JIT type of it's containedScriptModule
.Instead of inferring the specific type of a Module, which could leads to too many candidate types (due to Module's multiple inheritance possibility), it's more straightforward to set it's type as a user-specified
ModuleInterface
type.We added an optional argument
type_hint
for users to set anRRef
for whatModuleInterface
type it's holds.Differential Revision: D7065050