Update README.md
Browse files
README.md
CHANGED
@@ -6,24 +6,11 @@ tags:
|
|
6 |
- tf2.0
|
7 |
inference: false
|
8 |
---
|
9 |
-
## 介绍
|
10 |
-
### tf版本
|
11 |
-
https://github.com/ZhuiyiTechnology/roformer
|
12 |
-
|
13 |
-
### pytorch版本+tf2.0版本
|
14 |
-
https://github.com/JunnYu/RoFormer_pytorch
|
15 |
-
|
16 |
-
## 安装
|
17 |
-
```bash
|
18 |
-
pip install roformer
|
19 |
-
或
|
20 |
-
pip install git+https://github.com/JunnYu/RoFormer_pytorch.git
|
21 |
-
```
|
22 |
|
23 |
## pytorch使用
|
24 |
```python
|
25 |
import torch
|
26 |
-
from
|
27 |
|
28 |
text = "今天[MASK]很好,我[MASK]去公园玩。"
|
29 |
tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_small")
|
@@ -47,7 +34,7 @@ print(pt_outputs_sentence)
|
|
47 |
## tensorflow2.0使用
|
48 |
```python
|
49 |
import tensorflow as tf
|
50 |
-
from
|
51 |
text = "今天[MASK]很好,我[MASK]去公园玩。"
|
52 |
tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_small")
|
53 |
tf_model = TFRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_small")
|
|
|
6 |
- tf2.0
|
7 |
inference: false
|
8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
## pytorch使用
|
11 |
```python
|
12 |
import torch
|
13 |
+
from transformers import RoFormerForMaskedLM, RoFormerTokenizer
|
14 |
|
15 |
text = "今天[MASK]很好,我[MASK]去公园玩。"
|
16 |
tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_small")
|
|
|
34 |
## tensorflow2.0使用
|
35 |
```python
|
36 |
import tensorflow as tf
|
37 |
+
from transformers import RoFormerTokenizer, TFRoFormerForMaskedLM
|
38 |
text = "今天[MASK]很好,我[MASK]去公园玩。"
|
39 |
tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_small")
|
40 |
tf_model = TFRoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_small")
|