This folder contains the source code for Multiple Edge Servers Assignment for Local Device in Hierarchical Federated Learning using PySyft framework
- Download Anaconda:
curl -O https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
- Activate Anaconda:
source ~/.bashrc
- Create the environment:
conda create -n pysyft python=3.8
- Activate the environment:
conda activate pysyft
- Install PySyft version 0.2.9:
pip install "syft<0.3.0"
To run the code, go to terminal and type
- For training:
python3 main.py --mode=MODE --train
- For validating:
python3 main.py --mode=MODE --no-train
There are currently 5 modes:
- normal -- In this mode, the trainer trains on a single machine.
- federated-iid -- This mode distributes the data set to the workers in the iid fashion. The trainer trains the model on the workers' machine and the model is sent to the central server for averaging.
- federated-non-iid -- This mode distributes the data set to the workers in the non-iid fashion. The trainer trains the model on the workers' machine and the model is sent to the central server for averaging.
- hierarchical-iid -- This mode is similar to the federated-iid mode but with an additional layer of edge servers between the central server and the workers. The edge server will average the workers' models after every I epochs, and the central server will average the edge servers' models after every G epochs.
- hierarchical-non-iid -- This mode is similar to the federated-non-iid mode but with an additional layer of edge servers between the central server and the workers. The edge server will average the workers' models after every I epochs, and the central server will average the edge servers' models after every G epochs.