HuggingFace镜像/prophetnet-large-uncased-squad-qg
模型介绍文件和版本分析
下载使用量0

prophetnet-large-uncased-squad-qg 针对 ProphetNet 在 SQuAD 1.1 数据集上进行问题生成任务的微调权重(从 原始 fairseq 版本仓库 转换而来)。
ProphetNet 是一款全新的预训练语言模型,专为序列到序列学习设计,采用了名为未来 n-gram 预测的新型自监督目标函数。
ProphetNet 凭借 n 流解码器能够预测更多未来标记。其原始实现为 Fairseq 版本,详见 GitHub 仓库。

使用方法

from transformers import ProphetNetTokenizer, ProphetNetForConditionalGeneration, ProphetNetConfig

model = ProphetNetForConditionalGeneration.from_pretrained('microsoft/prophetnet-large-uncased-squad-qg')
tokenizer = ProphetNetTokenizer.from_pretrained('microsoft/prophetnet-large-uncased-squad-qg')

FACT_TO_GENERATE_QUESTION_FROM = ""Bill Gates [SEP] Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975."

inputs = tokenizer([FACT_TO_GENERATE_QUESTION_FROM], return_tensors='pt')

# Generate Summary
question_ids = model.generate(inputs['input_ids'], num_beams=5, early_stopping=True)
tokenizer.batch_decode(question_ids, skip_special_tokens=True)

# should give: 'along with paul allen, who founded microsoft?'

引用

@article{yan2020prophetnet,
  title={Prophetnet: Predicting future n-gram for sequence-to-sequence pre-training},
  author={Yan, Yu and Qi, Weizhen and Gong, Yeyun and Liu, Dayiheng and Duan, Nan and Chen, Jiusheng and Zhang, Ruofei and Zhou, Ming},
  journal={arXiv preprint arXiv:2001.04063},
  year={2020}
}