Skip to content

Code for paper "Federated Model Decomposition with Private Vocabulary for Text Classification"

License

Notifications You must be signed in to change notification settings

SMILELab-FL/FedVocab

Repository files navigation

FedeVocab

Licence Build

Code for paper "Federated Model Decomposition with Private Vocabulary for Text Classification". In this paper, we propose a fedrated model decomposition method that protects the privacy of vocabularies, shorted as FedeVocab.

Installation

Directory Structure

Before using our code, we recommend running FedeVocab according to the following directory structure:

├── workspace  
│   └── data   
|   |   └── fednlp_data  
│   ├── pretrain
│   │   └── cv  
│   ├── output  
│   └── code  
│       └── fedevocab

You can run the following command:

mkdir workspace  
cd workspace  
mkdir data  
mkdir code  
mkdir pretrained  
cd pretrained  
mkdir nlp  
cd ..  
cd code  

Requirement

The python version of the running environment is 3.7+ and the pytorch version is 1.10+.

git clone 
cd fedevocab  
pip install -r resquirements.txt  

How to run FedeVocab

Our code is built on FedNLP. To use our code, you must clone FedNLP.

Utility Experiments

bash run/detlm_alone/fedrun_sweep.sh sst_2 distilbert v100 2

Privacy Experiments

bash run/attack/dlg.sh /workspace {save_times} {model_type} {gpu_id} {batch_size}

Licence

Apache 2.0

About

Code for paper "Federated Model Decomposition with Private Vocabulary for Text Classification"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published