Downloads · 30 days
12
16% of all-time downloads
quincyqiang/nezha-cn-base
nezha-cn-base is a machine learning model from quincyqiang. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
Downloads · 30 days
12
16% of all-time downloads
All-time downloads
74
Public
Repo size
820 MB
Likes
3
Public
Click a slice to open those files.
.bin410 MB · 100%
From the Hugging Face model README
pytorch版NEZHA,适配transformers
pip install git+https://github.com/yanqiangmiffy/Nezha-Pytorch.git
https://github.com/lonePatient/NeZha_Chinese_PyTorch
import torch
from transformers import BertTokenizer
from nezha import NeZhaModel, NeZhaConfig
text = "今天[MASK]很好,我[MASK]去公园玩。"
tokenizer = BertTokenizer.from_pretrained(
"quincyqiang/nezha-cn-base"
)
model = NeZhaModel.from_pretrained(
"quincyqiang/nezha-cn-base"
)
config = NeZhaConfig.from_pretrained(
"quincyqiang/nezha-cn-base"
)
model.eval()
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)