-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable RRef proxy helpers to work with ScriptModule #48294
Labels
better-engineering
Relatively self-contained tasks for better engineering contributors
module: rpc
Related to RPC, distributed autograd, RRef, and distributed optimizer
oncall: jit
Add this issue/PR to JIT oncall triage queue
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Comments
rohan-varma
added
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
better-engineering
Relatively self-contained tasks for better engineering contributors
module: rpc
Related to RPC, distributed autograd, RRef, and distributed optimizer
labels
Nov 20, 2020
facebook-github-bot
added
the
oncall: jit
Add this issue/PR to JIT oncall triage queue
label
Nov 20, 2020
rohan-varma
added a commit
that referenced
this issue
Nov 20, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented: ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Nov 20, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented: ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Nov 20, 2020
Pull Request resolved: #48339 Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented: ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` ghstack-source-id: 117283506 Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/)
rohan-varma
added a commit
that referenced
this issue
Nov 29, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Nov 29, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Nov 29, 2020
Pull Request resolved: #48339 Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` ghstack-source-id: 117428758 Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/)
rohan-varma
added a commit
that referenced
this issue
Nov 29, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Nov 29, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Nov 29, 2020
Pull Request resolved: #48339 Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` ghstack-source-id: 117431386 Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/)
Doesn't seem like this issue needs any triage from JIT side. Removing from JIT triage queue. |
rohan-varma
added a commit
that referenced
this issue
Dec 2, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Dec 2, 2020
Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/) [ghstack-poisoned]
rohan-varma
added a commit
that referenced
this issue
Dec 2, 2020
Pull Request resolved: #48339 Closes #48294 #48293 added creation and transfer of ScriptModule over RPC in python, but it did not work with ScriptModule. This PR makes the above work with ScriptModule as per a discussion with @mrshenli: 1) We remove the `hasattr()` check and just let Python throw the exception as it would when accessing the py function with `getattr` 2) We condition on `issubclass(type, ScriptModule)` when checking if it is wrapped with async_function, because `ScriptModule` does not have getattr implemented (this is because ScriptModule forward/function is not a python function, it is a torchscript specific function): ``` torch/jit/_script.py", line 229, in __get__ return self.__getattr__("forward") # type: ignore AttributeError: '_CachedForward' object has no attribute '__getattr__' ``` ghstack-source-id: 117631795 Differential Revision: [D25134423](https://our.internmc.facebook.com/intern/diff/D25134423/)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
better-engineering
Relatively self-contained tasks for better engineering contributors
module: rpc
Related to RPC, distributed autograd, RRef, and distributed optimizer
oncall: jit
Add this issue/PR to JIT oncall triage queue
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃殌 Feature
We are adding support for transferring ScriptModule over the wire in RPC, see #48293. However, this does not currently work with RRef helper, due to the check on this line: https://github.com/pytorch/pytorch/blob/master/torch/distributed/rpc/rref_proxy.py#L18.
There is a workaround, however, which is to implement the helper without the check in user code:
Proposal is instead of checking for the exact type, such as
type(x) is A
which is what we are doing right now, we check the equivalent ofisinstance(x, A)
for the rref.cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @gqchen @aazzolini @rohan-varma @jjlilley @osalpekar @jiayisuse @gmagogsfm
The text was updated successfully, but these errors were encountered: