Skip to content

FedLab-NLP: A Fast and highly Customizable Framework for Federated Learning in Natural Language Processing

License

Notifications You must be signed in to change notification settings

SMILELab-FL/FedLab-NLP

Repository files navigation

FedLab-NLP

SMILELAB Licence Build

致力于联邦自然语言处理发展

1️⃣ 本项目来自 SMILELab-FL , 我们主要致力于联邦自然语言处理的发展;
2️⃣ FedLab-NLP是一款轻量级、可自由定制联邦学习过程并面向于自然语言处理的代码框架;
3️⃣ FedLab-NLP主要实现基于 FedLabHuggingFace,能完成自然语言预训练大模型在联邦学习场景下工作;
4️⃣ 任何使用问题可以联系 📧 iezhuo17@gmail.com

Installation

目录组织

我们建议按照如下的文件结构来使用FedLab-NLP:

data:  存放数据集,注意该数据集需要已经经过 iid/niid 划分的联邦数据集;
pretrained:  在nlp文件夹里存储从huggingface中下载的预训练模型,如`bert-base-uncased`;
code:  在该文件夹下面使用`FedLab-NLP`;
output: 存储模型输出的记录等。

目录组织如下:

├── workspace  
│   └── data  
|   |   ├── fedglue  
|   |   └── fedner  
│   ├── pretrained  
│   │   ├── nlp  
│   │   └── cv  
│   ├── output  
│   └── code  
│       └── FedLab-NLP  

运行路径生成:

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

环境安装

建议运行环境的python版本为3.7+,我们建议使用pytorch版本为1.10+

git clone git@git.openi.org.cn:Trustworthy-DL/FedLab-NLP.git  
cd FedLab-NLP  
pip install -r resquirements.txt  

Usage

支持 fedavg 联邦学习算法

bash fed_run.sh {your_file_path}/workspace {task_name} fedavg 10001 {server_gpu_id} {client1_gpu_id} {client2_gpu_id}

支持 centralized 集中训练学习算法

bash cen_run.sh {your_file_path}/workspace {task_name} centralized 10001 {server_gpu_id}

Contributing

License

Apache License 2.0

About

FedLab-NLP: A Fast and highly Customizable Framework for Federated Learning in Natural Language Processing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published