PySyft icon indicating copy to clipboard operation
PySyft copied to clipboard

Error: Tuple of tensors being returned from websockets

Open DanyEle opened this issue 7 years ago • 5 comments

Describe the bug When invoking a method returning a tuple of tensors on a remote tensor that is stored on a remote websocket, an error occurs.

To Reproduce Steps to reproduce the error:

  1. Startup a remote websocket on the local machine
cd 
cd PySyft/examples/tutorials/advanced/websockets-example-MNIST
python3 run_websocket_server.py --id alice --host 127.0.0.1 --port 8777
  1. In a new terminal, initialize syft and hook the remote websocket

import torch
import syft as sy
from syft.workers import WebsocketClientWorker
 
hook = sy.TorchHook(torch)

kwargs_websocket_alice = {"host": "127.0.0.1", "hook": hook}
alice= WebsocketClientWorker(id="alice", port=8777, **kwargs_websocket_alice)
  1. Initialize a tensor and send it to the remote worker:
random_tensor = torch.randn(5,3)
remote_tensor = random_tensor.send(alice)
positions, sorted_values = torch.sort(remote_tensor)

It seems to be somehow related to the way PySyft returns tuples of tensors. Notice that this issues does not occur on virtual sockets, but just on remote web socket!

Error in the remote console:

image

DanyEle avatar May 31 '19 07:05 DanyEle

The reason of this error is that with virtualworkers, a syft.exceptions.ResponseSignatureError is sent back from servers workers to the client, which is not supported by socketworkers. Maybe we would like to handle Exception forwarding through some serialization process.

LaRiffle avatar May 31 '19 17:05 LaRiffle

This issue #2214 is related And #2219 attempts to give fix.

LaRiffle avatar Jun 01 '19 21:06 LaRiffle

HI @DanyEle - should we close?

iamtrask avatar Jun 03 '19 09:06 iamtrask

@iamtrask If it's fixed in #2219, then sure!

DanyEle avatar Jun 03 '19 09:06 DanyEle

@DanyEle It is now merged!

LaRiffle avatar Jun 04 '19 17:06 LaRiffle