File size: 1,347 Bytes
18cdc2d
05de898
2bf2c45
204eecb
 
 
 
 
 
2bf2c45
05de898
 
 
18cdc2d
 
 
 
 
 
 
 
 
05de898
18cdc2d
05de898
 
18cdc2d
 
 
 
 
 
 
 
 
 
 
 
 
 
c9c90db
a05d43a
18cdc2d
 
05de898
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

## Overview
```
Language model: Pegasus-xsum
Language: English
Downstream-task: Question-Answering Generation
Training data: SQuAD 2.0, NewsQA
Eval data: SQuAD 2.0, NewsQA
Infrastructure: Nvidia Tesla K80 12Gb RAM
```

## Hyperparameters
```
per_device_train_batch_size = 2
per_device_eval_batch_size = 2
num_train_epochs = 3
base_LM_model = "pegasus-xsum"
source_max_token_len = 256
target_max_token_len = 64
learning_rate = 5e-5
lr_schedule = LinearWarmup
warmup_steps = 150
```

## Usage
```python
import transformers
from transformers import PegasusForConditionalGeneration, PegasusTokenizerFast

model_name = 'nloc2578/QAG_Pegasus_3ep_eval'
tokenizer = PegasusTokenizerFast.from_pretrained(model_name)
model = PegasusForConditionalGeneration.from_pretrained(model_name, pad_token_id=tokenizer.eos_token_id)

text = '''The primary goal of distractor generation is generating answer
options that are plausibly answers to the question, and might appear
correct to a user who does know the correct answer. Distractors
should also be clearly distinct from the key and each other and
they should not be correct answers to the question (for questions
that might have multiple correct answers).'''

input_id = tokenizer(text, return_tensors='pt')
output = model.generate(input_id['input_ids'])
result = tokenizer.decode(output[0])

print(result)
```