Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bos url for UIE #3222

Merged
merged 3 commits into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions model_zoo/uie/data_distill/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,54 @@

## 数据准备

本项目中从CMeIE数据集中采样少量数据展示了UIE数据蒸馏流程,[示例数据下载](https://bj.bcebos.com/paddlenlp/datasets/uie/doccano_ext.json),解压后放在``../data``目录下。
本项目中从CMeIE数据集中采样少量数据展示了UIE数据蒸馏流程,[示例数据下载](https://bj.bcebos.com/paddlenlp/datasets/uie/data_distill/data.zip),解压后放在``../data``目录下。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

解压命令也写上去吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thx


```shell
wget https://bj.bcebos.com/paddlenlp/datasets/uie/data_distill/data.zip && unzip data.zip -d ../
```

示例数据包含以下两部分:

| 名称 | 数量 |
| :---: | :-----: |
| 标注数据(doccano格式) | 200 |
| 无标注数据 | 1277 |
| doccano格式标注数据(doccano_ext.json)| 200 |
| 无标注数据(unlabeled_data.txt)| 1277 |

## UIE Finetune

参考[UIE主文档](../README.md)完成UIE模型微调。

训练集/验证集切分:

```shell
python doccano.py \
--doccano_file ./data/doccano_ext.json \
--task_type ext \
--save_dir ./data \
--splits 0.8 0.2 0
```

模型微调:

```shell
python finetune.py --train_path ./data/train.txt --dev_path ./data/dev.txt --learning_rate 5e-6 --batch_size 2
python finetune.py \
--train_path ./data/train.txt \
--dev_path ./data/dev.txt \
--learning_rate 5e-6 \
--batch_size 2
```

## 离线蒸馏

#### 通过训练好的UIE定制模型预测无监督数据的标签

```shell
python data_distill.py --data_path ../data --save_dir student_data --task_type relation_extraction --synthetic_ratio 10 --model_path ../checkpoint/model_best
python data_distill.py \
--data_path ../data \
--save_dir student_data \
--task_type relation_extraction \
--synthetic_ratio 10 \
--model_path ../checkpoint/model_best
```

可配置参数说明:
Expand Down