CoolFace
Modelpublic

consciousAI/question-generation-auto-hints-t5-v1-base-s-q

sourceHugging Faceupdated 4y agoView on Hugging Face
1likes23downloads
Model Card

Auto Question Generation

The model is intended to be used for Auto And/Or Hint enabled Question Generation tasks. The model is expected to produce one or possibly more than one question from the provided context.

Live Demo: Question Generation

Including this there are five models trained with different training sets, demo provide comparison to all in one go. However, you can reach individual projects at below links:

Auto Question Generation v1

Auto Question Generation v2

Auto Question Generation v3

Auto/Hints based Question Generation v2

This model can be used as below:

from transformers import (
    AutoModelForSeq2SeqLM,
    AutoTokenizer
)

model_checkpoint = "consciousAI/question-generation-auto-hints-t5-v1-base-s-q"

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, look at demo
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 '?' You can write a small wrapper to elegantly format. Look at the demo.
questions = [tokenizer.decode(id, clean_up_tokenization_spaces=False, skip_special_tokens=False) for id in output]

Training and evaluation data

Squad & QNLi combo.

Training hyperparameters

The following hyperparameters were used during training:

  • —learning_rate: 0.0003
  • —trainbatchsize: 4
  • —evalbatchsize: 4
  • —seed: 42
  • —optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • —lrschedulertype: linear
  • —num_epochs: 10

Training results

Training LossEpochStepValidation LossRouge1Rouge2RougelRougelsum
1.82981.0145151.75290.35350.18250.32510.3294
1.49312.0290301.71320.35580.18810.32670.3308
1.27563.0435451.75790.36040.19010.33070.3345
1.09364.0580601.81730.360.19010.32950.3334
0.9555.0725751.92040.36110.18840.32950.3336
0.81176.0870902.01830.3550.18360.32410.3282
0.69497.01016052.13470.35560.18360.32420.3282
0.6368.01161202.25670.35680.18550.32480.3286
0.5919.01306352.35980.35630.18440.32380.3281
0.541710.01451502.47250.35560.18280.32290.3269

Framework versions

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