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/xprophetnet-large-wiki100-cased/README.md
README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: multilingual
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
## xprophetnet-large-wiki100-cased
|
| 6 |
+
Cross-lingual version [ProphetNet](https://arxiv.org/abs/2001.04063), pretrained on [wiki100 xGLUE dataset](https://arxiv.org/abs/2004.01401).
|
| 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 |
+
xProphetNet is also served as the baseline model for xGLUE cross-lingual natural language generation tasks.
|
| 11 |
+
For xGLUE corss-lingual NLG tasks, xProphetNet is finetuned with English data, but inference with both English and other zero-shot language data.
|
| 12 |
+
|
| 13 |
+
### Usage
|
| 14 |
+
|
| 15 |
+
This pre-trained model can be fine-tuned on *sequence-to-sequence* tasks. The model could *e.g.* be trained on English headline generation as follows:
|
| 16 |
+
|
| 17 |
+
```python
|
| 18 |
+
from transformers import XLMProphetNetForConditionalGeneration, XLMProphetNetTokenizer
|
| 19 |
+
|
| 20 |
+
model = XLMProphetNetForConditionalGeneration.from_pretrained("microsoft/xprophetnet-large-wiki100-cased")
|
| 21 |
+
tokenizer = XLMProphetNetTokenizer.from_pretrained("microsoft/xprophetnet-large-wiki100-cased")
|
| 22 |
+
|
| 23 |
+
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 ."
|
| 24 |
+
target_str = "us rejects charges against its ambassador in bolivia"
|
| 25 |
+
|
| 26 |
+
input_ids = tokenizer(input_str, return_tensors="pt").input_ids
|
| 27 |
+
labels = tokenizer(target_str, return_tensors="pt").input_ids
|
| 28 |
+
|
| 29 |
+
loss = model(input_ids, labels=labels).loss
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Note that since this model is a multi-lingual model it can be fine-tuned on all kinds of other languages.
|
| 33 |
+
|
| 34 |
+
### Citation
|
| 35 |
+
```bibtex
|
| 36 |
+
@article{yan2020prophetnet,
|
| 37 |
+
title={Prophetnet: Predicting future n-gram for sequence-to-sequence pre-training},
|
| 38 |
+
author={Yan, Yu and Qi, Weizhen and Gong, Yeyun and Liu, Dayiheng and Duan, Nan and Chen, Jiusheng and Zhang, Ruofei and Zhou, Ming},
|
| 39 |
+
journal={arXiv preprint arXiv:2001.04063},
|
| 40 |
+
year={2020}
|
| 41 |
+
}
|
| 42 |
+
```
|