Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Sample usage:
|
| 2 |
+
```python
|
| 3 |
+
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
| 4 |
+
model = GPT2LMHeadModel.from_pretrained("danyaljj/gpt2_question_answering_squad2")
|
| 5 |
+
|
| 6 |
+
input_ids = tokenizer.encode("There are two apples on the counter. Q: How many apples? A:", return_tensors="pt")
|
| 7 |
+
outputs = model.generate(input_ids)
|
| 8 |
+
print("Generated:", tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
Which should produce this:
|
| 12 |
+
```
|
| 13 |
+
Generated: There are two apples on the counter. Q: How many apples? A: two
|
| 14 |
+
```
|