Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
datasets:
|
5 |
+
- squad
|
6 |
+
---
|
7 |
+
A question generation model trained on `SQuAD` dataset.
|
8 |
+
|
9 |
+
Example usage:
|
10 |
+
|
11 |
+
```py
|
12 |
+
from transformers import BartConfig, BartForConditionalGeneration, BartTokenizer
|
13 |
+
|
14 |
+
model_name = "alinet/bart-base-squad-qg"
|
15 |
+
|
16 |
+
tokenizer = BartTokenizer.from_pretrained(model_name)
|
17 |
+
model = BartForConditionalGeneration.from_pretrained(model_name)
|
18 |
+
|
19 |
+
def run_model(input_string, **generator_args):
|
20 |
+
input_ids = tokenizer.encode(input_string, return_tensors="pt")
|
21 |
+
res = model.generate(input_ids, **generator_args)
|
22 |
+
output = tokenizer.batch_decode(res, skip_special_tokens=True)
|
23 |
+
print(output)
|
24 |
+
|
25 |
+
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)
|
26 |
+
# ['What is the Stanford Question Answering Dataset?']
|
27 |
+
```
|