julien-c HF staff commited on
Commit
b8aa2a3
1 Parent(s): 8b53598

Migrate model card from transformers-repo

Browse files

Read 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/README.md

Files changed (1) hide show
  1. README.md +37 -0
README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ ---
4
+
5
+ ## prophetnet-large-uncased
6
+ Pretrained weights for [ProphetNet](https://arxiv.org/abs/2001.04063).
7
+ ProphetNet is a new pre-trained language model for sequence-to-sequence learning with a novel self-supervised objective called future n-gram prediction.
8
+ 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).
9
+
10
+ ### Usage
11
+
12
+ This pre-trained model can be fine-tuned on *sequence-to-sequence* tasks. The model could *e.g.* be trained on headline generation as follows:
13
+
14
+ ```python
15
+ from transformers import ProphetNetForConditionalGeneration, ProphetNetTokenizer
16
+
17
+ model = ProphetNetForConditionalGeneration.from_pretrained("microsoft/prophetnet-large-uncased")
18
+ tokenizer = ProphetNetTokenizer.from_pretrained("microsoft/prophetnet-large-uncased")
19
+
20
+ input_str = "the us state department said wednesday it had received no formal word from bolivia that it was expelling the us ambassador there but said the charges made against him are `` baseless ."
21
+ target_str = "us rejects charges against its ambassador in bolivia"
22
+
23
+ input_ids = tokenizer(input_str, return_tensors="pt").input_ids
24
+ labels = tokenizer(target_str, return_tensors="pt").input_ids
25
+
26
+ loss = model(input_ids, labels=labels).loss
27
+ ```
28
+
29
+ ### Citation
30
+ ```bibtex
31
+ @article{yan2020prophetnet,
32
+ title={Prophetnet: Predicting future n-gram for sequence-to-sequence pre-training},
33
+ author={Yan, Yu and Qi, Weizhen and Gong, Yeyun and Liu, Dayiheng and Duan, Nan and Chen, Jiusheng and Zhang, Ruofei and Zhou, Ming},
34
+ journal={arXiv preprint arXiv:2001.04063},
35
+ year={2020}
36
+ }
37
+ ```