XLNet 模型在英语语言上进行了预训练。它由 Yang 等人在论文 XLNet: Generalized Autoregressive Pretraining for Language Understanding 中提出,并首次在 此仓库 发布。
免责声明:发布 XLNet 的团队未为此模型编写模型卡片,因此本模型卡片由 Hugging Face 团队编写。
XLNet 是一种新的无监督语言表示学习方法,它基于一种新颖的广义排列语言建模目标。此外,XLNet 采用 Transformer-XL 作为骨干模型,在涉及长上下文的语言任务中表现出卓越性能。总体而言,XLNet 在各种下游语言任务上取得了最先进(SOTA)的结果,包括问答、自然语言推理、情感分析和文档排序。
请注意,此模型主要旨在在使用整个句子(可能被掩码)进行决策的任务上进行微调,例如序列分类、 token 分类或问答。对于文本生成等任务,您应该考虑 GPT2 等模型。
以下是如何在 PyTorch 中使用此模型获取给定文本特征的方法:
from openmind import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained('PyTorch-NPU/xlnet_base_cased')
model = AutoModel.from_pretrained('PyTorch-NPU/xlnet_base_cased').to("npu:0")
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt").to("npu:0")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state@article{DBLP:journals/corr/abs-1906-08237,
author = {Zhilin Yang and
Zihang Dai and
Yiming Yang and
Jaime G. Carbonell and
Ruslan Salakhutdinov and
Quoc V. Le},
title = {XLNet: Generalized Autoregressive Pretraining for Language Understanding},
journal = {CoRR},
volume = {abs/1906.08237},
year = {2019},
url = {http://arxiv.org/abs/1906.08237},
eprinttype = {arXiv},
eprint = {1906.08237},
timestamp = {Mon, 24 Jun 2019 17:28:45 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-1906-08237.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}