When multiplying two encrypted tensors, it occurs a Cannot serialize NodeClient object error
However, there's no error when the version of syft changed to 0.2.5
import syft as sy
import torch as th
from syft.workers.node_client import NodeClient
hook = sy.TorchHook(th)
alice = NodeClient(hook, "ws://<ip>:<port>", id="alice")
bob = NodeClient(hook, "ws://<ip>:<port>", id="bob")
charlie = NodeClient(hook, "ws://<ip>:<port>", id="charlie")
grid = sy.PrivateGridNetwork(alice, bob, charlie)
x = th.tensor([[ 0.9039, 0.6291, 1.0795],
[ 0.1586, 2.1939, -0.4900],
[-0.1909, -0.7503, 1.9355]])
y = th.tensor([[ 0.9039, 0.1586, -0.1909],
[ 0.6291, 2.1939, -0.7503],
[ 1.0795, -0.4900, 1.9355]])
x_s = x.fix_prec().share(alice, bob, crypto_provider=charlie)
y_s = y.fix_prec().share(alice, bob, crypto_provider=charlie)
result_s = x_s.matmul(y_s)
An error message as below
Traceback (most recent call last):
File "test_mul_shared_tensors_copy_1.py", line 24, in <module>
result_s = x_s.matmul(y_s)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/generic/frameworks/hook/hook.py", line 210, in overloaded_native_method
response = method(*new_args, **new_kwargs)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/frameworks/torch/tensors/interpreters/precision.py", line 432, in matmul
response = getattr(new_self, "matmul")(*new_args, **new_kwargs)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/frameworks/torch/tensors/interpreters/additive_shared.py", line 648, in matmul
return self._private_mul(other, "matmul")
File "/home/billy/billy_ws/fl_0529/PySyft/syft/frameworks/torch/tensors/interpreters/additive_shared.py", line 538, in _private_mul
shares = spdz.spdz_mul(cmd, self, other, self.crypto_provider, self.field, self.dtype)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/frameworks/torch/mpc/spdz.py", line 34, in spdz_mul
crypto_provider, cmd, field, dtype, x_sh.shape, y_sh.shape, locations
File "/home/billy/billy_ws/fl_0529/PySyft/syft/frameworks/torch/mpc/beaver.py", line 39, in request_triple
res.share(*locations, field=field, dtype=dtype, crypto_provider=crypto_provider).get().child
File "/home/billy/billy_ws/fl_0529/PySyft/syft/frameworks/torch/tensors/interpreters/native.py", line 909, in share
**kwargs_,
File "/home/billy/billy_ws/fl_0529/PySyft/syft/generic/pointers/pointer_tensor.py", line 382, in share
response = self.owner.send_command(self.location, "share", self, args, kwargs)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/workers/base.py", line 628, in send_command
ret_val = self.send_msg(message, location=recipient)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/workers/base.py", line 272, in send_msg
bin_message = sy.serde.serialize(message, worker=self)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/serde/serde.py", line 45, in serialize
return strategy(obj, worker, simplified, force_full_simplification)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/serde/msgpack/serde.py", line 337, in serialize
return _serialize_msgpack_binary(simple_objects)
File "/home/billy/billy_ws/fl_0529/PySyft/syft/serde/msgpack/serde.py", line 291, in _serialize_msgpack_binary
binary = msgpack_lib.dumps(simple_objects)
File "/home/billy/miniconda3/envs/py3.6-0529/lib/python3.6/site-packages/msgpack/__init__.py", line 35, in packb
return Packer(**kwargs).pack(o)
File "msgpack/_packer.pyx", line 286, in msgpack._cmsgpack.Packer.pack
File "msgpack/_packer.pyx", line 292, in msgpack._cmsgpack.Packer.pack
File "msgpack/_packer.pyx", line 289, in msgpack._cmsgpack.Packer.pack
File "msgpack/_packer.pyx", line 258, in msgpack._cmsgpack.Packer._pack
File "msgpack/_packer.pyx", line 258, in msgpack._cmsgpack.Packer._pack
File "msgpack/_packer.pyx", line 258, in msgpack._cmsgpack.Packer._pack
[Previous line repeated 3 more times]
File "msgpack/_packer.pyx", line 283, in msgpack._cmsgpack.Packer._pack
TypeError: can not serialize 'NodeClient' object
Thanks @bobsonlin26 , could you include the label grid?
Thanks @bobsonlin26 , could you include the label
grid?
I don't know how to add a new label....
(I've tried to edit this issue, but no option for me to apply a new label)
Maybe it's because I'm not a contributor/member (?
@LaRiffle @Syzygianinfern0 , I guess you have been working in multiplication of AST . I remember a bug related with this #3496 and maybe is related...
This issue has been marked stale because it has been open 30 days with no activity. Leave a comment or remove the stale label to unmark it. Otherwise, this will be closed in 7 days.
I'm wondering why would a NodeClient need to be sent?
This issue has been marked stale because it has been open 30 days with no activity. Leave a comment or remove the stale label to unmark it. Otherwise, this will be closed in 7 days.
Most helpful comment
Thanks @bobsonlin26 , could you include the label
grid?