:w:q
Browse files:q
erge branch 'main' of https://huggingface.co/danyaljj/gpt2_question_generation_given_paragraph_answer into main
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sample usage:
|
| 2 |
+
```python
|
| 3 |
+
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 4 |
+
model = GPT2LMHeadModel.from_pretrained("danyaljj/gpt2_question_generation_given_paragraph_answer")
|
| 5 |
+
input_ids = tokenizer.encode("There are two apples on the counter. A: apples Q:", return_tensors="pt")
|
| 6 |
+
outputs = model.generate(input_ids)
|
| 7 |
+
print("Generated:", tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 8 |
+
```
|
| 9 |
+
Which should produce this:
|
| 10 |
+
```
|
| 11 |
+
Generated: There are two apples on the counter. A: apples Q: What is the name of the counter
|
| 12 |
+
```
|