🚀 BART釋義模型(大模型)
這是一個基於BART的大型序列到序列(文本生成)模型,在3個釋義數據集上進行了微調。該模型可有效用於文本釋義生成。
🚀 快速開始
你可以使用預訓練模型對輸入句子進行釋義。以下是使用示例:
import torch
from transformers import BartForConditionalGeneration, BartTokenizer
input_sentence = "They were there to enjoy us and they were there to pray for us."
model = BartForConditionalGeneration.from_pretrained('eugenesiow/bart-paraphrase')
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = model.to(device)
tokenizer = BartTokenizer.from_pretrained('eugenesiow/bart-paraphrase')
batch = tokenizer(input_sentence, return_tensors='pt')
generated_ids = model.generate(batch['input_ids'])
generated_sentence = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
print(generated_sentence)
輸出
['They were there to enjoy us and to pray for us.']
✨ 主要特性
- 模型架構:Bart採用標準的序列到序列/機器翻譯架構,包含一個雙向編碼器(如BERT)和一個從左到右的解碼器(如GPT)。
- 預訓練任務:預訓練任務包括隨機打亂原句子的順序和一種新穎的填充方案,其中文本片段被單個掩碼標記替換。
- 微調效果:BART在針對文本生成進行微調時特別有效。此模型在3個釋義數據集(Quora、PAWS和MSR釋義語料庫)上進行了微調。
📚 詳細文檔
模型描述
BART模型由Lewis等人(2019年)在論文BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension中提出。
原始的BART代碼來自這個倉庫。
預期用途和限制
該模型可用於對輸入句子進行釋義。
訓練數據
該模型在預訓練的facebook/bart-large
基礎上進行微調,使用了Quora、PAWS和MSR釋義語料庫。
訓練過程
我們遵循simpletransformers序列到序列示例中提供的訓練過程。
引用信息
@misc{lewis2019bart,
title={BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension},
author={Mike Lewis and Yinhan Liu and Naman Goyal and Marjan Ghazvininejad and Abdelrahman Mohamed and Omer Levy and Ves Stoyanov and Luke Zettlemoyer},
year={2019},
eprint={1910.13461},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
📄 許可證
本項目採用Apache-2.0許可證。
📦 信息表格
屬性 |
詳情 |
模型類型 |
基於BART的序列到序列(文本生成)模型 |
訓練數據 |
Quora、PAWS和MSR釋義語料庫 |