Views
No views yet
<hl>) and prefixed with 'generate question: '. For QA the input is processed like this question: question_text context: context_text </s>generate question: <hl> 42 <hl> is the answer to life, the universe and everything. </s>question: What is 42 context: 42 is the answer to life, the universe and everything. </s>1from pipelines import pipeline
2nlp = pipeline("multitask-qa-qg", model="valhalla/t5-base-qa-qg-hl")
3
4# to generate questions simply pass the text
5nlp("42 is the answer to life, the universe and everything.")
6=> [{'answer': '42', 'question': 'What is the answer to life, the universe and everything?'}]
7
8# for qa pass a dict with "question" and "context"
9nlp({
10 "question": "What is 42 ?",
11 "context": "42 is the answer to life, the universe and everything."
12})
13=> 'the answer to life, the universe and everything'