Views
No views yet
1>>> from transformers import MvpTokenizer, MvpForConditionalGeneration
2
3>>> tokenizer = MvpTokenizer.from_pretrained("RUCAIBox/mvp")
4>>> model = MvpForConditionalGeneration.from_pretrained("RUCAIBox/mvp-question-answering")
5
6>>> inputs = tokenizer(
7... "Answer the following question: From which country did Angola achieve independence in 1975?",
8... return_tensors="pt",
9... )
10>>> generated_ids = model.generate(**inputs)
11>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
12['Portugal']1@article{tang2022mvp,
2 title={MVP: Multi-task Supervised Pre-training for Natural Language Generation},
3 author={Tang, Tianyi and Li, Junyi and Zhao, Wayne Xin and Wen, Ji-Rong},
4 journal={arXiv preprint arXiv:2206.12131},
5 year={2022},
6 url={https://arxiv.org/abs/2206.12131},
7}