This repository contains official code and models for the paper, Salvaging Federated Learning by Local Adaptation.
Our implementation works with Python >=3.7 and PyTorch>=1.2.0. Install other dependencies: $ pip install -r requirement.txt
We use two datasets in the paper:
- CIFAR-10 through torchvision datasets
- Reddit data, fetch following shared data and unzip files correspondingly,
- For the federated learning model, configure the parameters using
utils/params.yaml
, to train a federated learning model on the Reddit Corpus, run:
$ python training.py --name text --params utils/words.yaml
- For the adaptation of the federated learning model, configure the parameters using
utils/adapt_text.yaml
orutils/adapt_image.yaml
, to adapt a federated learning model on the Reddit Corpus, run:
$ python adapt.py --name text --params utils/adapt_text.yaml
Similarly, change text
, words.yaml
and adapt_text.yaml
into image
, params.yaml
and adapt_text.yaml
to train and adapt the federated learning model on CIFAR.
If you use our code or wish to refer to our results, please use the following BibTex entry:
@misc{yu2020salvaging,
title={Salvaging Federated Learning by Local Adaptation},
author={Tao Yu and Eugene Bagdasaryan and Vitaly Shmatikov},
year={2020},
eprint={2002.04758},
archivePrefix={arXiv},
primaryClass={cs.LG}
}