This repository accompanies the paper. Here you can find all the code, needed to launch experiments. Below you can see an instruction, on how one should proceed to reproduce the results.
- Create a virtual environment. For example:
python3 -m venv venv
- Activate it:
source venv/bin/activate
- Install requirements:
pip install -r requitements.txt
- Make sure, that tests work:
pytest
!!!! NOTE, that we have not attached model weights since they are heavy. Make sure you run appropriate experiment beforehand to plot pictures from notebooks! !!!!
Then, to launch main experiments, one should specify the config file (which is stored in ./configs) and run main.py script.
Example:
python main.py --config ./configs/cifar_10_2.yml
Depending on the used dataset, the resulting model, config file and metrics will be saved to either experiment_logs ( cifar10) or experiment_logs100 (cifar100) folder. Folders will be enumerated, depending on the number of the experiment.
If you want to launch experiments with heterogeneous data, use the following
command: python run_exps_heterogeneous_data.py
For FedRep, DITTO, APFL, and others we used the code from the official FedRep repository. In some places of our code (notebooks), there are links to the FedRep. Make sure you cloned this repo next to our project folder.
The toy example (inspired from Exploiting Shared Representations for Personalized Federated Learning) can be found in notebooks/Toy_example.ipynb. There, you can play with it and receive plots.