Draft: Feature/opacus dp
Three different features are considered here:
1- PoC for local differential privacy integration with opacus for pytorch models: two notebooks containing two tutorials: pytorch-opacus-classifier-CIFAR10.ipynb
and pytorch-opacus-MNIST.ipynb
. In addition opacus
has been added to the environnements.
2- Creation of a new training plan for training pytorch models that allows enabling DP with opacus through a model arguments (optional). The new training plan is TorchTrainingDPPlan
from fedbiomed.common.torchnnDP
. Three additional notebooks are provided to check compatibility with this new training plan with previous examples and tutorials with opacus: 101_getting-started-2.ipynb
, pytorch-opacus-classifier-CIFAR10-2.ipynb
and pytorch-opacus-MNIST-2.ipynb
3- Possibility to add any torchvision
dataset to a node and decide a ratio for randomly sampling only a portion of the selected dataset to induce heterogeneity at the node level. The modified files are cli.py
and data_manager.py
. When option 2) default
is selected the client should give:
- Name of the database (from torchvision.datasets): --> e.g. MNIST if he wants to add the mnist dataset
- Ratio of #name dataset in the current node (float, 0<ratio<=1): --> e.g. 0.5 if we want to add only a randomly subset containing the 50% of samples from the selected dataset
- #name will be added with tags
['##name','#dataset']
[y/N]: y
The three features can be considered separately. In particular 3- will entail some modifications at the documentation level.