PySyft from Jupyter notebook to Python script

276 Views Asked by At

I am trying to follow the instructions of PySyft in order to launch a duet.

My actual problem is that I can not execute the following commands in a .py file

duet.store.pandas
duet.store[key]

Τhis is a demo to reproduce the mistake

Firstly "Data Owner"

import syft as sy 
import torch as th
import time

duet=sy.launch_duet("network_url=http://localhost:5000",loopback=True)
print(duet)
x=th.Tensor([1,2,3]).tag("data")
x_p=x.send(duet,pointable=True)
print(x_p)

with the following output

♫♫♫ > CONNECTED!

<DomainClient: <UID: daf0e0361efa494f860ce451e780f084>>
<syft.proxy.torch.TensorPointer object at 0x000002627F06F790>

and secondly "Data Scientist"

import syft as sy
import torch as th 
import time 

time.sleep(20)
duet=sy.join_duet("network_url=http://localhost:5000",loopback=True)
print(duet)
print("sleep")
time.sleep(30)
if duet is not None:
    print("before exec")
    ptr=duet.store["data"]
    print("its executed")

with the following output


♫♫♫ > CONNECTED!
<Duet: <UID: daf0e0361efa494f860ce451e780f084>>
sleep
before exec

The "its executed" is never printed and the program does not finish its execution.

0

There are 0 best solutions below