This repo was created to provide a good base for experimenting with federated learning methods with minimal requirements and complexity.
This repo contains a PyTorch implementation of Generalized FedAvg (Algorithm 1), where the user has several degrees of freedom in terms of algorithmic design. In particular, the user can define:
- global and local optimizers (SGD is implemented)
- aggregation scheme (simple mean is implemented)
- client sampling (uniform sampling is implemented)
The source code is provided in the fl_sim directory. The user can extend the usability by implementing new aggregation schemes (fl_sim/aggregation), client samplings (fl_sim/client_sampling, or by bringing in new models (fl_sim/models and datasets (fl_sim/data_funcs. The user can also define a new task in tasks.py. The repo also contains two notebooks. The first notebook contains an example of a simple task, where it generates the script to run experiments via terminal. The second notebook provides means to visualize obtained results.
For more advanced FL simulators based on PyTorch, we recommend
- FL_Pytorch: https://github.com/burlachenkok/flpytorch
- FLSim: https://github.com/facebookresearch/FLSim
- fl-simulation: https://github.com/microsoft/fl-simulation
If you are looking for a framework that goes beyond simple simulations, we recommend
- Flower: https://flower.dev/
- FedML: https://github.com/FedML-AI