junnyu's picture
Update README.md
c0705cc
|
raw
history blame
616 Bytes
metadata
language: zh
tags:
  - roformer

介绍

tf版本

https://github.com/ZhuiyiTechnology/roformer

pytorch版本

https://github.com/JunnYu/RoFormer_pytorch

使用

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)