Federated Learning research framework in your mind
Project description
FedMind
A simple and easy Federated Learning framework fit researchers' mind based on PyTorch.
Unlike other popular FL frameworks focusing on production, FedMind is designed for researchers to easily implement their own FL algorithms and experiments. It provides a simple and flexible interface to implement FL algorithms and experiments.
Installation
The package is published on PyPI under the name fedmind. You can install it with pip:
pip install fedmind
Usage
A configuration file in yaml is required to run the experiments.
You can refer to the config.yaml as an example.
There are examples in the examples directory.
Make a copy of both the config.yaml and fedavg_demo.py to your own directory. You can run them with the following command:
python fedavg_demo.py
Here we recommend you to use the UV as a python environment manager to create a clean environment for the experiments.
After install uv, you can create a new environment and run a FedMind example with the following command:
uv init FL-demo
cd FL-demo
source .uv/bin/activate
uv add fedmind torchvision
wget https://raw.githubusercontent.com/Xiao-Chenguang/FedMind/refs/heads/main/examples/fedavg_demo.py
wget https://raw.githubusercontent.com/Xiao-Chenguang/FedMind/refs/heads/main/config.yaml
uv run python fedavg_demo.py
Features
- Simple: Easy to implement your own FL algorithms and experiments.
- PyTorch: Based on PyTorch, a popular deep learning framework.
- Multi-Platform: Support both Linux, macOS and Windows.
- CPU/GPU: Support both CPU and GPU training.
- Serial/Parallel: Support both serial and parallel training modes.
- Model Operation: Support model level operations like
+,-,*,/. - Reproducible: Reproduce your experiments with the
configuration fileandseed.
Serial/Parallel Training
This FL framework provides two client simulation modes depending on your resources:
- Parallel training speed up for powerful resources.
- Serialization for limited resources.
This is controlled by the parameter NUM_PROCESS which can be set in the config.yaml.
Setting NUM_PROCESS to 0 will use the serialization mode where each client trains sequentially in same global round.
Setting NUM_PROCESS > 0 will use the parallel mode where NUM_PROCESS workers consume the clients tasks in parallel.
The recommended value for NUM_PROCESS is the number of CPU cores available.
Notice on Windows
Multiprocessing with CUDA is not supported on Windows. If you are using Windows, you should set NUM_PROCESS to 0 to use the serialization mode with CUDA. Or you are free to use the parallel mode with CPU only.
Acknowledgement
- This project includes code from easydict, licensed under the GNU Lesser General Public License (LGPL) version 3.0. See the easydict's LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fedmind-0.2.0.tar.gz.
File metadata
- Download URL: fedmind-0.2.0.tar.gz
- Upload date:
- Size: 77.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c8262c87153e4b3e0324ab171ff5339e43c2f23f326e82cfafdc429fbcbea2b
|
|
| MD5 |
bdce4b35f61144fb7296a34ae5053259
|
|
| BLAKE2b-256 |
0a0f0c3c56699e2f03e887a52fab0b9643cac5f0d74b1ba9e8b938633bf89749
|
File details
Details for the file fedmind-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fedmind-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd7341dea2bd824f6feddb6b236eb02d63a17bc2b8d522da4364419f38e4e267
|
|
| MD5 |
217e04621ebd4c3323206074070da3a3
|
|
| BLAKE2b-256 |
080e85dc3b96a045a7599de80bf4bc9b161e3ea50ba9737aeeef0f10ff07ad13
|