Federated learning and differential privacy with pytorch


I would like to do some experiments on federated learning and differential privacy using pytorch.

I saw the below blog post on openmined.org
Opacus + PySyft - A short demo

Then, I wanted to give it a try on Google Colab.

But unfortunately, the code on this blog post is not working. I think there are some compatibility issues with the current versions of syft, opacus, torch etc.

I would be glad if someone can share a working copy of the similar example?

error was at this line:

—> hook = sy.TorchHook(th)
AttributeError: module ‘syft’ has no attribute ‘TorchHook’

The question is still open from my side. I need a working code (pytorch) example of a federated learning demo utilizing differential privacy.

Any help on this will be highly appreciated.

You seem to hit this issue which seems to be a deprecated approach:

it looks like you are trying to use the old 0.2.x method of TorchHook in 0.3.0 which is no longer needed.
This raises a very good issue which is we need to add a 0.2.x upgrade explanation to our README.md so thanks, I will get this in the pipeline asap.

Unfortunately the linked README is broken, so unsure what the replacement would be.