Instructions to use junnyu/roformer_chinese_base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- paddlenlp
How to use junnyu/roformer_chinese_base with paddlenlp:
from paddlenlp.transformers import AutoTokenizer, RoFormerForMaskedLM tokenizer = AutoTokenizer.from_pretrained("junnyu/roformer_chinese_base", from_hf_hub=True) model = RoFormerForMaskedLM.from_pretrained("junnyu/roformer_chinese_base", from_hf_hub=True) - Notebooks
- Google Colab
- Kaggle
update readme
Browse files
README.md
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## 介绍
|
| 2 |
+
tf版本 https://github.com/ZhuiyiTechnology/roformer
|
| 3 |
+
pytorch版本 https://github.com/JunnYu/RoFormer_pytorch
|
| 4 |
+
|
| 5 |
+
## 使用
|
| 6 |
+
```python
|
| 7 |
+
git clone https://github.com/JunnYu/RoFormer_pytorch
|
| 8 |
+
cd RoFormer_pytorch
|
| 9 |
+
import torch
|
| 10 |
+
from model import RoFormerModel, RoFormerTokenizer
|
| 11 |
+
tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_base")
|
| 12 |
+
model = RoFormerModel.from_pretrained("junnyu/roformer_chinese_base")
|
| 13 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 14 |
+
with torch.no_grad():
|
| 15 |
+
outputs = model(**inputs).last_hidden_state
|
| 16 |
+
print(outputs.shape)
|
| 17 |
+
```
|