Views
No views yet
1tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
2model = GPT2LMHeadModel.from_pretrained("danyaljj/gpt2_question_generation_given_paragraph_answer")
3input_ids = tokenizer.encode("There are two apples on the counter. A: apples Q:", return_tensors="pt")
4outputs = model.generate(input_ids)
5print("Generated:", tokenizer.decode(outputs[0], skip_special_tokens=True))Generated: There are two apples on the counter. A: apples Q: What is the name of the counter