Skip to content

Commit

Permalink
add paddlehub
Browse files Browse the repository at this point in the history
  • Loading branch information
kinghuin committed Mar 23, 2020
1 parent 3663d24 commit 20b5960
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Ziqing Yang, Shijin Wang, Guoping


## 新闻
2020/3/23 本目录发布的模型已接入[飞桨PaddleHub](https://github.com/PaddlePaddle/PaddleHub),查看[快速加载](#快速加载)

**2020/3/11 为了更好地了解需求邀请您填写[调查问卷](https://wj.qq.com/s2/5637766/6281),以便为大家提供更好的资源**

2020/2/26 哈工大讯飞联合实验室发布[知识蒸馏工具TextBrewer](https://github.com/airaria/TextBrewer)
Expand Down Expand Up @@ -112,6 +114,8 @@ PyTorch版本则包含`pytorch_model.bin`, `bert_config.json`, `vocab.txt`文件


### 快速加载
1. 使用Huggingface-Transformers

依托于[Huggingface-Transformers 2.2.2](https://github.com/huggingface/transformers),可轻松调用以上模型
```
tokenizer = BertTokenizer.from_pretrained("MODEL_NAME")
Expand All @@ -130,6 +134,26 @@ model = BertModel.from_pretrained("MODEL_NAME")
| RBT3 | hfl/rbt3 |
| RBTL3 | hfl/rbtl3 |

2. 使用PaddleHub

依托[PaddleHub](https://github.com/PaddlePaddle/PaddleHub),我们只需一行代码即可完成模型下载安装十余行代码即可完成文本分类序列标注阅读理解等任务

```
import paddlehub as hub
module = hub.Module(name=MODULE_NAME)
```

其中`MODULE_NAME`对应列表如下

| 模型名 | MODULE_NAME |
| - | - |
| RoBERTa-wwm-ext-large | [chinese-roberta-wwm-ext-large](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-roberta-wwm-ext-large&en_category=SemanticModel) |
| RoBERTa-wwm-ext | [chinese-roberta-wwm-ext](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-roberta-wwm-ext&en_category=SemanticModel) |
| BERT-wwm-ext | [chinese-bert-wwm-ext](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-bert-wwm-ext&en_category=SemanticModel) |
| BERT-wwm | [chinese-bert-wwm](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-bert-wwm&en_category=SemanticModel) |
| RBT3 | [rbt3](https://www.paddlepaddle.org.cn/hubdetail?name=rbt3&en_category=SemanticModel) |
| RBTL3 | [rbtl3](https://www.paddlepaddle.org.cn/hubdetail?name=rbtl3&en_category=SemanticModel) |


### 测试任务数据
我们提供部分任务数据请查看`data`目录了解
Expand Down
23 changes: 23 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ For further accelerating Chinese natural language processing, we provide **Chine


## News
2020/3/23 The models in this repository now can be easily accessed through [PaddleHub](https://github.com/PaddlePaddle/PaddleHub), check [Quick Load](#Quick-Load)

**2020/2/26 We release a knowledge distillation toolkit [TextBrewer](https://github.com/airaria/TextBrewer)**

2020/1/20 Happy Chinese New Year! We've released RBT3 and RBTL3 (3-layer RoBERTa-wwm-ext-base/large), check [Small Models](#Small-Models)
Expand Down Expand Up @@ -97,6 +99,8 @@ chinese_wwm_L-12_H-768_A-12.zip


### Quick Load
1. Huggingface-Transformers

With [Huggingface-Transformers](https://github.com/huggingface/transformers), the models above could be easily accessed and loaded through the following codes.
```
tokenizer = BertTokenizer.from_pretrained("MODEL_NAME")
Expand All @@ -115,6 +119,25 @@ The actual model and its `MODEL_NAME` are listed below.
| RBT3 | hfl/rbt3 |
| RBTL3 | hfl/rbtl3 |

2. PaddleHub

With [PaddleHub](https://github.com/PaddlePaddle/PaddleHub), we can download and install the model with one line of code.

```
import paddlehub as hub
module = hub.Module(name=MODULE_NAME)
```

The actual model and its `MODULE_NAME` are listed below.

| Original Model| MODULE_NAME |
| - | - |
| RoBERTa-wwm-ext-large | [chinese-roberta-wwm-ext-large](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-roberta-wwm-ext-large&en_category=SemanticModel) |
| RoBERTa-wwm-ext | [chinese-roberta-wwm-ext](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-roberta-wwm-ext&en_category=SemanticModel) |
| BERT-wwm-ext | [chinese-bert-wwm-ext](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-bert-wwm-ext&en_category=SemanticModel) |
| BERT-wwm | [chinese-bert-wwm](https://www.paddlepaddle.org.cn/hubdetail?name=chinese-bert-wwm&en_category=SemanticModel) |
| RBT3 | [rbt3](https://www.paddlepaddle.org.cn/hubdetail?name=rbt3&en_category=SemanticModel) |
| RBTL3 | [rbtl3](https://www.paddlepaddle.org.cn/hubdetail?name=rbtl3&en_category=SemanticModel) |

### Task Data
We only provide the data that is publically available, check `data` directory.
Expand Down

0 comments on commit 20b5960

Please sign in to comment.