OpenFed: A Comprehensive and Versatile Open-Source Federated Learning Framework
Introduction
OpenFed is a foundational library for federated learning research and supports many research projects. It reduces the barrier to entry for both researchers and downstream users of Federated Learning by the targeted removal of existing pain points. For researchers, OpenFed provides a framework wherein new methods can be easily implemented and fairly evaluated against an extensive suite of benchmarks. For downstream users, OpenFed allows Federated Learning to be plug and play within different subject-matter contexts, removing the need for deep expertise in Federated Learning.
Install
PyTorch >= 1.5.1, python>=3.6
Build latest version from source with conda:
conda create -n openfed python=3.7 -y
conda activate openfed
git clone https://github.com/FederalLab/OpenFed.git
cd OpenFed
pip install -e .
Stable version: pip install openfed
Start Federated Learning in an Unprecedented Simple Way
- Install extra package:
pip install torchvision numpy
- Download MNIST dataset:
python examples/run.py --download
- Start a simulation (
nproc
means the total number of federated nodes):
python -m openfed.tools.simulator --nproc 6 examples/run.py
100%|██████████████████████████████████████████| 10/10 [00:01<00:00, 6.49it/s]
Citation
If you find this project useful in your research, please consider cite:
@misc{chen2021openfed,
title={OpenFed: A Comprehensive and Versatile Open-Source Federated Learning Framework},
author={Dengsheng Chen and Vince Tan and Zhilin Lu and Jie Hu},
year={2021},
eprint={2109.07852},
archivePrefix={arXiv},
primaryClass={cs.CR}
}
Contributing
We appreciate all contributions to improve OpenFed. Please refer to CONTRIBUTING.md for the contributing guideline.
License
OpenFed is released under the MIT License.