File size: 2,605 Bytes
7bd3fcb
 
 
 
 
 
7116384
7bd3fcb
 
 
7116384
7bd3fcb
 
 
a82dc16
7bd3fcb
 
 
a82dc16
7bd3fcb
a82dc16
 
 
 
 
 
 
 
 
7bd3fcb
2965b96
a82dc16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bd3fcb
a82dc16
7bd3fcb
 
 
 
aeeba8e
a82dc16
 
7bd3fcb
 
a82dc16
7bd3fcb
 
a82dc16
7bd3fcb
 
 
a82dc16
 
 
 
7bd3fcb
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
tags:
- generated_from_trainer
metrics:
- rouge
model-index:
- name: anshoomehra/t5-v1-base-s2-auto-qgen
  results: []
---

# t5-v1-base-s2-auto-qgen

## Model description

This model was fine-tuned from base t5 v1.1 on SQUAD2 for auto-question generation(i.e. without hints).

## Intended uses & limitations

The model is expected to produce one or possibly more than one question from provided context. If you are looking for model which receive hints as input or combination, these will be added soon and the link will be provided here: ##)

This model can be used as below:

```
from transformers import (
    AutoModelForSeq2SeqLM,
    AutoTokenizer
)

model_checkpoint = "anshoomehra/t5-v1_1-base-squadV2AutoQgen"

model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)

## Input with prompt
context="question_context: <context>"
encodings = tokenizer.encode(context, return_tensors='pt', truncation=True, padding='max_length').to(device)

## You can play with many hyperparams to condition the output
output = model.generate(encodings, 
                        #max_length=300, 
                        #min_length=20, 
                        #length_penalty=2.0, 
                        num_beams=4,
                        #early_stopping=True,
                        #do_sample=True,
                        #temperature=1.1
                       )

## Multiple questions are expected to be delimited by </s>
questions = [tokenizer.decode(id, clean_up_tokenization_spaces=False, skip_special_tokens=False) for id in output]
```

## Training and evaluation data

SQUAD split.

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 0.0003
- train_batch_size: 2
- eval_batch_size: 2
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 10

### Training results
Rouge metrics is heavily penalized because of multiple questions in target sample space.

| Training Loss | Epoch | Step  | Validation Loss | Rouge1 | Rouge2 | Rougel | Rougelsum |
|:-------------:|:-----:|:-----:|:---------------:|:------:|:------:|:------:|:---------:|
| 2.0146        | 1.0   | 4758  | 1.6980          | 0.143  | 0.0705 | 0.1257 | 0.1384    |
...
| 1.1733        | 9.0   | 23790 | 1.6319          | 0.1404 | 0.0718 | 0.1239 | 0.1351    |
| 1.1225        | 10.0  | 28548 | 1.6476          | 0.1407 | 0.0716 | 0.1245 | 0.1356    |


### Framework versions

- Transformers 4.23.0.dev0
- Pytorch 1.12.1+cu113
- Datasets 2.5.2
- Tokenizers 0.13.0