Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/microsoft/prophetnet-large-uncased-squad-qg/README.md
README.md
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
datasets:
|
4 |
+
- squad
|
5 |
+
---
|
6 |
+
|
7 |
+
##
|
8 |
+
prophetnet-large-uncased-squad-qg
|
9 |
+
Fine-tuned weights(converted from [original fairseq version repo](https://github.com/microsoft/ProphetNet)) for [ProphetNet](https://arxiv.org/abs/2001.04063) on question generation
|
10 |
+
SQuAD 1.1.
|
11 |
+
ProphetNet is a new pre-trained language model for sequence-to-sequence learning with a novel self-supervised objective called future n-gram prediction.
|
12 |
+
ProphetNet is able to predict more future tokens with a n-stream decoder. The original implementation is Fairseq version at [github repo](https://github.com/microsoft/ProphetNet).
|
13 |
+
|
14 |
+
### Usage
|
15 |
+
```
|
16 |
+
from transformers import ProphetNetTokenizer, ProphetNetForConditionalGeneration, ProphetNetConfig
|
17 |
+
|
18 |
+
model = ProphetNetForConditionalGeneration.from_pretrained('microsoft/prophetnet-large-uncased-squad-qg')
|
19 |
+
tokenizer = ProphetNetTokenizer.from_pretrained('microsoft/prophetnet-large-uncased-squad-qg')
|
20 |
+
|
21 |
+
FACT_TO_GENERATE_QUESTION_FROM = ""Bill Gates [SEP] Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975."
|
22 |
+
|
23 |
+
inputs = tokenizer([FACT_TO_GENERATE_QUESTION_FROM], return_tensors='pt')
|
24 |
+
|
25 |
+
# Generate Summary
|
26 |
+
question_ids = model.generate(inputs['input_ids'], num_beams=5, early_stopping=True)
|
27 |
+
tokenizer.batch_decode(question_ids, skip_special_tokens=True)
|
28 |
+
|
29 |
+
# should give: 'along with paul allen, who founded microsoft?'
|
30 |
+
```
|
31 |
+
### Citation
|
32 |
+
```bibtex
|
33 |
+
@article{yan2020prophetnet,
|
34 |
+
title={Prophetnet: Predicting future n-gram for sequence-to-sequence pre-training},
|
35 |
+
author={Yan, Yu and Qi, Weizhen and Gong, Yeyun and Liu, Dayiheng and Duan, Nan and Chen, Jiusheng and Zhang, Ruofei and Zhou, Ming},
|
36 |
+
journal={arXiv preprint arXiv:2001.04063},
|
37 |
+
year={2020}
|
38 |
+
}
|
39 |
+
```
|