Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
---
|
| 5 |
+
A question generation model trained on `alinet/balanced_qg` dataset.
|
| 6 |
+
|
| 7 |
+
Example usage:
|
| 8 |
+
|
| 9 |
+
```py
|
| 10 |
+
from transformers import BartConfig, BartForConditionalGeneration, BartTokenizer
|
| 11 |
+
|
| 12 |
+
model_name = "alinet/bart-base-balanced-qg"
|
| 13 |
+
|
| 14 |
+
tokenizer = BartTokenizer.from_pretrained(model_name)
|
| 15 |
+
model = BartForConditionalGeneration.from_pretrained(model_name)
|
| 16 |
+
|
| 17 |
+
def run_model(input_string, **generator_args):
|
| 18 |
+
input_ids = tokenizer.encode(input_string, return_tensors="pt")
|
| 19 |
+
res = model.generate(input_ids, **generator_args)
|
| 20 |
+
output = tokenizer.batch_decode(res, skip_special_tokens=True)
|
| 21 |
+
print(output)
|
| 22 |
+
|
| 23 |
+
run_model("Stanford Question Answering Dataset (SQuAD) is a reading comprehension dataset, consisting of questions posed by crowdworkers on a set of Wikipedia articles, where the answer to every question is a segment of text, or span, from the corresponding reading passage, or the question might be unanswerable.", max_length=32, num_beams=4)
|
| 24 |
+
# ['What is the Stanford Question Answering Dataset?']
|
| 25 |
+
```
|