Code for the paper "Continual Federated Learning Based on Knowledge Distillation"
- python 3.7+
- cuda 9.0+
- pytorch 1.7+
In the code, we use 0~8 to denote the catagories in text classification tasks: Finance(0), Entertainment(1), Education(2), Fashion(3), Stock(4), Technology(5), Home(6), Sports(7), Social(8).
There is only the Sina2019
dataset which is generated by ourselves in the ./dataset
folder.
Limited by the maximium size of uploaded files, only the subsets of the original dataset are included under the path ./dataset
.
To reproduce the work, you need to download the complete datasets:
- THUCNews: http://thuctc.thunlp.org/
- Sogou News: http://www.sogou.com/labs/resource/cs.php
- Sina2019: provided after the paper is accepted
- NLPIR Weibo Corpus: http://www.nlpir.org/wordpress/download/weibo.7z
- CIFAR-10 & CIFAR-100: http://www.cs.toronto.edu/~kriz/cifar.html
- Caltech-256: http://www.cs.toronto.edu/~kriz/cifar.html
To construct the required tasks, we provide some tools in construct_tasks.py
.
- Run the code like this:
python3 federated_run.py --model=TextCNN --paradigm=CFeD --scenario=class-IL
,where the parameterparadigm
denotes which method is choosen andscenario
.
- positional arguments:
- model:{TextCNN, TextCNNMultihead, CNN_Cifar10, CNN_Cifar10_multihead, CNN_Cifar100}
- paradigme:{CFeD, dmc, lwf, ewc, multihead, normal}
- scenario:{domain, class}
- Limited by the maximum size of the uploaded file, we decrease the hyper-parameters, like
batch_size
. To change the hyper-parameters, you can modify the specific model files under./model
, like./model/TextCNN.py
.