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