PyTorch-Federated-Learning provides various federated learning baselines implemented using the PyTorch framework. The codebase follows a client-server architecture and is highly intuitive and accessible.
If you find this repository useful, please let me know with your stars:star:. Thank you!
-
Current Baseline implementations: Pytorch implementations of the federated learning baselines. The currently supported baselines are FedAvg, FedNova, FedProx and SCAFFOLD:
-
Dataset preprocessing: Downloading the benchmark datasets automatically and dividing them into a number of clients w.r.t. federated settings. The currently supported datasets are MNIST, Fashion-MNIST, SVHN, CIFAR-10, CIFAR-100. Other datasets need to be downloaded manually.
-
Postprocessing: Visualization of the training results for evaluation.
- Python (3.8)
- PyTorch (1.8.1)
- OpenCV (4.5)
- numpy (1.21.5)
Run: pip install -r requirements.txt
to install the required packages.
This preprocessing aims to divide the entire datasets into a dedicated number of clients with respect to federated settings. Depending on the the number of classes in each local dataset, the entire dataset are split into Non-IID datasets in terms of label distribution skew.
Hyperparameters are defined in a yaml file, e.g. "./config/test_config.yaml", and then just run with this configuration:
python fl_main.py --config "./config/test_config.yaml"
Please run python postprocessing/eval_main.py -rr 'results'
to plot the testing accuracy and training loss by the increasing number of epochs or communication rounds.
Note that the labels in the figure is the name of result files
Our recent work about FedBEVT and ResFed:
@ARTICLE{song2023fedbevt,
author={Song, Rui and Xu, Runsheng and Festag, Andreas and Ma, Jiaqi and Knoll, Alois},
journal={IEEE Transactions on Intelligent Vehicles},
title={FedBEVT: Federated Learning Bird's Eye View Perception Transformer in Road Traffic Systems},
year={2023},
pages={1-12},
doi={10.1109/TIV.2023.3310674}}
@ARTICLE{song2022resfed,
author={Song, Rui and Zhou, Liguo and Lyu, Lingjuan and Festag, Andreas and Knoll, Alois},
journal={IEEE Internet of Things Journal},
title={ResFed: Communication Efficient Federated Learning With Deep Compressed Residuals},
year={2023},
volume={},
number={},
pages={1-15},
doi={10.1109/JIOT.2023.3324079}}