Get 0.2.x Dataloader working in 0.3.x
Description
Try to get the 0.2.x Dataloader example working in 0.3.x and figure out if there are any changes required: https://github.com/OpenMined/PySyft/blob/syft_0.2.x/examples/tutorials/Part%2007%20-%20Federated%20Learning%20with%20Federated%20Dataset.ipynb
Definition of Done
A PR which demonstrates this working in a notebook.
Hi,
Please assign this issue to me. I would like to work on this.
Can I also try and work on this issue.. I am just getting started but would like to work on this issue too.
@sbasu26 Sure, as you asked first I will assign it to you, but if you cannot work on it please report back quickly so that someone else can take it.
@madhavajay Thank you so much!
want to work on this
@sbasu26 I haven't seen any PR's so i'm clearing the assignment and will leave it until someone can submit a PR. Please note we have our own internal roadmaps so if something needs doing and there is no PR we reserve the right to just do it ourselves. In the interest of making sure your work is not wasted effort ALWAYS provide a Draft PR ASAP so that we can see if the solution is heading in the right direction and even help collaborate with you to get it merged. If you wait too long to push and open a PR the issue may be done by someone else first.
Can I try work on this issue?
Hey @madhavajay, can you help me to get started with this issue?
@madhavajay I had assigned this issue to myself as I was working on Federated Learning and Split Learning using PySyft 0.2 from Nov onwards. I was just completing my training of a Split Learning network on VGG19 using PySyft, when my Laptop had crashed. After getting my Laptop fixed, when I freshly tried to install PySyft 0.3 on my laptop from scratch I got the error that I raised in issue https://github.com/OpenMined/PySyft/issues/4986.
I would request to be given some more time so that I can complete the installation successfully and raise a PR for this issue as soon as possible.
Hi @sbasu26 thats unfortunate, i'm sorry to hear about your laptop crash. I still see no PR's for this Issue. People regularly ask to have issues assigned to them and then disappear so I am no longer assigning issues to people unless they can at least lodge a PR showing some progress so we can help them. Not having a PR opened means that at any moment all your work could be completely wasted when our team decides we need that issue fixed fast and just do it ourselves. This has happened before so to prevent wasting contributors time, I am asking that people start on the issue, open a draft PR and we can discuss if it is going in the right direction and provide help.
I would like to work on this and I'm trying to understand the notebook. I'm not asking to get assigned in this, but please don't close this issue.
The create_sandbox function does not exist in 0.3. To make the dataloader work we need that function.
https://github.com/OpenMined/PySyft/issues/3728
This needs to be fixed. Credits to Kishan Sairam Adapa for this.
Link to Slack post: https://openmined.slack.com/archives/C6EEFN3A8/p1609763826164500
Hi, I have been working on this for some days and got some code. This works fine in 0.4(via setup.py), but fails in 0.3(pip install syft=0.3.0). I think some bugs need to be fixed to make it work.
After the training is complete, the model can not be retrieved because "'Linear' object has no attribute 'serializable_wrapper_type'", Do I have to put it in a class MyLinear(sy.Module)?
import syft as sy
import sklearn
import torch
from sklearn.datasets import load_boston
alice = sy.VirtualMachine()
alice_client = alice.get_root_client()
dataset = load_boston()
boston_data = torch.tensor(dataset["data"]).float()
boston_target = torch.tensor(dataset["target"]).float()
#tensors below appear in alice_client.store
boston_data.send(alice_client, searchable =True)
boston_target.send(alice_client, searchable =True)
#torch.utils.data.TensorDataset is not wrapped, generate the dataset manually.
ds = [t for t in zip(boston_data, boston_target)]
ds = sy.lib.python.List(ds)
ds.send(alice_client, searchable=True)
#in 0.3, error occurs, 'ds' is invisible
#print(len(alice_client.stroe)) ==> 2
#when trying to read alice.store, error occurs at obj_search_service.py:process()
#--> 211 ptr_type = obj2pointer_type(obj=obj.data)
#UnboundLocalError("local variable 'ref' referenced before assignment")
#so "ds" is invisible in alice_client
remote_torch = alice_client.torch
#torch.nn.Linear is not wrapped, can not be sent
remote_model = remote_torch.nn.Linear(13, 1)
remote_dl = remote_torch.utils.data.DataLoader(
alice_client.store[2], batch_size=32, shuffle=True
)
#make the request to be approved automatically(#5015), or exception "Request to access data length not granted"
remote_dl.set_request_config({})
loss_accum = 0
for i, t in enumerate(remote_dl):
optimizer = remote_torch.optim.Adam(params=remote_model.parameters(),lr=1e-2)
optimizer.zero_grad()
data, target = t[0], t[1]
pred = remote_model(data)
loss = ((pred.view(-1) - target)**2).mean()
loss.backward()
optimizer.step()
gotloss = loss.get()
loss_accum += float(gotloss)
print(i, gotloss)
print(loss_accum)
@uid42 are you able to create a PR against the dev branch then we can discuss the issues and how to help get it fixed? 😊
@madhavajay @uid42 Since there has been no activity for a while, I created a new PR based on @uid42. I solved the problem of getting a remote model, the issue of sending listpointer has not been solved yet, though it works well in 0.4.
@Koukyosyumei Awesome work! I see your PR and i'll take a look shortly. 😊