File size: 864 Bytes
c0705cc 1aaee5a c0705cc 5eaf1fe e7b9eb6 5eaf1fe 50a1512 5eaf1fe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
---
language: zh
tags:
- roformer
inference: false
---
## 介绍
### tf版本
https://github.com/ZhuiyiTechnology/roformer
### pytorch版本
https://github.com/JunnYu/RoFormer_pytorch
## 使用
```python
git clone https://github.com/JunnYu/RoFormer_pytorch
cd RoFormer_pytorch
import torch
from model import RoFormerModel, RoFormerTokenizer
tokenizer = RoFormerTokenizer.from_pretrained("junnyu/roformer_chinese_base")
model = RoFormerModel.from_pretrained("junnyu/roformer_chinese_base")
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs).last_hidden_state
print(outputs.shape)
```
## 引用
Bibtex:
```tex
@techreport{zhuiyiroformer,
title={RoFormer: Transformer with Rotary Position Embeddings - ZhuiyiAI},
author={Jianlin Su},
year={2021},
url="https://github.com/ZhuiyiTechnology/roformer",
}
``` |