模型:
facebook/bart-large
BART模型是在英语语言上预训练的。它是由刘易斯等人在 BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension 的论文中提出,并于 this repository 首次发布。
免责声明:发布BART的团队没有为这个模型编写模型卡片,所以此模型卡片是由Hugging Face团队编写的。
BART是一个具有双向(BERT风格)编码器和自回归(GPT风格)解码器的转换器编码器-解码器(seq2seq)模型。BART通过(1)使用任意的噪声函数破坏文本,并(2)学习一个模型来重构原始文本进行预训练。
BART在文本生成(例如摘要、翻译)的微调任务中表现特别有效,但对于理解任务(例如文本分类、问题回答)也表现良好。
您可以使用原始模型进行文本填充。然而,该模型主要用于在监督数据集上进行微调。请参考 model hub 以查找您感兴趣的任务上的微调版本。
以下是如何在PyTorch中使用此模型的示例:
from transformers import BartTokenizer, BartModel tokenizer = BartTokenizer.from_pretrained('facebook/bart-large') model = BartModel.from_pretrained('facebook/bart-large') inputs = tokenizer("Hello, my dog is cute", return_tensors="pt") outputs = model(**inputs) last_hidden_states = outputs.last_hidden_state
@article{DBLP:journals/corr/abs-1910-13461, author = {Mike Lewis and Yinhan Liu and Naman Goyal and Marjan Ghazvininejad and Abdelrahman Mohamed and Omer Levy and Veselin Stoyanov and Luke Zettlemoyer}, title = {{BART:} Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension}, journal = {CoRR}, volume = {abs/1910.13461}, year = {2019}, url = {http://arxiv.org/abs/1910.13461}, eprinttype = {arXiv}, eprint = {1910.13461}, timestamp = {Thu, 31 Oct 2019 14:02:26 +0100}, biburl = {https://dblp.org/rec/journals/corr/abs-1910-13461.bib}, bibsource = {dblp computer science bibliography, https://dblp.org} }