OpenMined / PySyft

Perform data science on data that remains in someone else's server
https://www.openmined.org/
Apache License 2.0
9.53k stars 1.99k forks source link

Part 10: Federated Learning with Encrypted Gradient Aggregation (Bug found) #2758

Closed Krypton3 closed 4 years ago

Krypton3 commented 4 years ago

Hi,

I was testing this tutorial with my own dataset. It's working fine till secure encrypted aggregation. However, I have found this error with my dataset. I have also followed the tutorial fully. It also shows the same error for secure encrypted aggregation.

The error is the following:

AttributeError Traceback (most recent call last)

in () 5 for epoch in range(args.epochs): 6 print(f"Epoch {epoch + 1}") ----> 7 train(epoch) 8 # test() 9 8 frames /usr/local/lib/python3.6/dist-packages/syft/frameworks/torch/hook/hook_args.py in (i) 32 backward_func = { 33 TorchTensor: lambda i: i.wrap(), ---> 34 torch.Tensor: lambda i: i.wrap(), 35 torch.nn.Parameter: lambda i: torch.nn.Parameter(data=i), 36 AutogradTensor: lambda i: AutogradTensor(data=i).on(i, wrap=False), AttributeError: 'numpy.ndarray' object has no attribute 'wrap'

@iamtrask @LaRiffle I would appreciate an explanation. Thank you.

alejandrosame commented 4 years ago

Hi there!

@iamtrask reported in the Slack group that the issue is due to the import of NumPy to execute log2 like shown in https://github.com/OpenMined/PySyft/blob/master/syft/frameworks/torch/tensors/interpreters/native.py#L741.

Since NumPy can only run locally, it cannot be used for Federated Learning yet. The solutions for this error would be to either:

Cheers!

MarksASP95 commented 4 years ago

Hey, I'm not sure how to apply the solutions you provided, could you be more specific?

MarksASP95 commented 4 years ago

This notebook works on version 0.1.13a1.

alejandrosame commented 4 years ago

Hi @MarksASP95!

Both solutions involve development. I'm currently working and documenting the NumPy integration on this issue.

github-actions[bot] commented 4 years ago

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.