An open API service indexing awesome lists of open source software.

https://github.com/smilelab-fl/fedlab-nlp

FedLab-NLP: A Fast and highly Customizable Framework for Federated Learning in Natural Language Processing
https://github.com/smilelab-fl/fedlab-nlp

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        


FedLab-NLP





SMILELAB
Licence
Build




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




1️⃣ 本项目来自 [SMILELab-FL](https://github.com/SMILELab-FL/FedLab-NLP) , 我们主要致力于联邦自然语言处理的发展;
2️⃣ `FedLab-NLP`是一款轻量级、可自由定制联邦学习过程并面向于自然语言处理的代码框架;
3️⃣ `FedLab-NLP`主要实现基于 [FedLab](https://github.com/SMILELab-FL/FedLab) 和 [HuggingFace](https://github.com/huggingface/transformers),能完成自然语言预训练大模型在联邦学习场景下工作;
4️⃣ 任何使用问题可以联系 :e-mail: [email protected]

## Installation

### 目录组织
我们建议按照如下的文件结构来使用`FedLab-NLP`:

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

目录组织如下:
```grapha
├── workspace
│ └── data
| | ├── fedglue
| | └── fedner
│ ├── pretrained
│ │ ├── nlp
│ │ └── cv
│ ├── output
│ └── code
│ └── FedLab-NLP
```

运行路径生成:
```bash
mkdir workspace
cd workspace
mkdir data
mkdir code
mkdir pretrained
cd pretrained
mkdir nlp
cd ..
cd code
```

### 环境安装
建议运行环境的`python`版本为`3.7+`,我们建议使用`pytorch`版本为`1.10+`
```bash
git clone [email protected]:Trustworthy-DL/FedLab-NLP.git
cd FedLab-NLP
pip install -r resquirements.txt
```

## Usage
支持 `fedavg` 联邦学习算法
```bash
bash fed_run.sh {your_file_path}/workspace {task_name} fedavg 10001 {server_gpu_id} {client1_gpu_id} {client2_gpu_id}
```

支持 `centralized` 集中训练学习算法
```bash
bash cen_run.sh {your_file_path}/workspace {task_name} centralized 10001 {server_gpu_id}
```
## Contributing

## License
[Apache License 2.0](https://github.com/SMILELab-FL/FedLab-NLP/blob/main/LICENSE)