Installation
You can install PFLlib via git:
Then install CUDA v11.6 following NVIDIA's instructions.
Install the latest version of conda and activate conda.
Install the required Python dependencies using
env_cuda_latest.yaml
and conda:
git clone https://github.com/TsingZ0/PFLlib.git
conda env create -f env_cuda_latest.yaml # You may need to downgrade the torch using pip to match the CUDA version.
Usage
Only two command lines are needed: one for dataset assignment and the other for FL algorithm execution.
- First, split the dataset (e.g., MNIST) and assign it to the clients:
- Finally, run the
main.py
with choosen configurations, FL algorithm, and hyperparameters:
# In ./dataset python generate_MNIST.py noniid - dir # for practical noniid and unbalanced scenario
# In ./system python main.py -data MNIST -m CNN -algo FedAvg -gr 2000 -did 0 # using the MNIST dataset, the FedAvg algorithm, and the 4-layer CNN model