Views
No views yet
context (e.g. news article)question <sep> answerg1) in our MQAG paper,
or please refer to the GitHub repo of this project: https://github.com/potsawee/mqag0.1>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3>>> tokenizer = AutoTokenizer.from_pretrained("potsawee/t5-large-generation-race-QuestionAnswer")
4>>> model = AutoModelForSeq2SeqLM.from_pretrained("potsawee/t5-large-generation-race-QuestionAnswer")
5
6>>> context = r"""
7... World number one Novak Djokovic says he is hoping for a "positive decision" to allow him
8... to play at Indian Wells and the Miami Open next month. The United States has extended
9... its requirement for international visitors to be vaccinated against Covid-19. Proof of vaccination
10... will be required to enter the country until at least 10 April, but the Serbian has previously
11... said he is unvaccinated. The 35-year-old has applied for special permission to enter the country.
12... Indian Wells and the Miami Open - two of the most prestigious tournaments on the tennis calendar
13... outside the Grand Slams - start on 6 and 20 March respectively. Djokovic says he will return to
14... the ATP tour in Dubai next week after claiming a record-extending 10th Australian Open title
15... and a record-equalling 22nd Grand Slam men's title last month.""".replace("\n", "")
16
17>>> inputs = tokenizer(context, return_tensors="pt")
18>>> outputs = model.generate(**inputs, max_length=100)
19>>> question_answer = tokenizer.decode(outputs[0], skip_special_tokens=False)
20>>> question_answer = question_answer.replace(tokenizer.pad_token, "").replace(tokenizer.eos_token, "")
21>>> question, answer = question_answer.split(tokenizer.sep_token)
22
23>>> print("question:", question)
24question: What is the best title for the passage?
25>>> print("answer:", answer)
26answer: Djokovic's application for special permission to enter the United States
27Context ---> Question + (A) Answer (B) Distractor1 (C) Distractor2 (D) Distractor31@article{manakul2023mqag,
2 title={MQAG: Multiple-choice Question Answering and Generation for Assessing Information Consistency in Summarization},
3 author={Manakul, Potsawee and Liusie, Adian and Gales, Mark JF},
4 journal={arXiv preprint arXiv:2301.12307},
5 year={2023}
6}