t5 small squad2 question generation
allenaiIntroduction
The T5-SMALL-SQUAD2-QUESTION-GENERATION model is a question-generation system built using the SQuAD 2.0 dataset. It utilizes the T5 architecture to transform input text into questions.
Architecture
This model is based on the T5 (Text-to-Text Transfer Transformer) architecture, supporting text-to-text generation tasks. It is compatible with the Transformers library, and it can be used with both PyTorch and JAX frameworks.
Training
The model is fine-tuned on the SQuAD 2.0 dataset, which includes questions and answers to improve the quality and relevance of generated questions. This dataset helps the model learn to generate contextually appropriate questions from input text.
Guide: Running Locally
To run this model locally, follow these steps:
-
Install Dependencies:
- Ensure you have Python installed.
- Install the Transformers library:
pip install transformers
-
Load the Model:
- Use the following code to load the model and tokenizer:
from transformers import T5Config, T5ForConditionalGeneration, T5Tokenizer model_name = "allenai/t5-small-squad2-question-generation" tokenizer = T5Tokenizer.from_pretrained(model_name) model = T5ForConditionalGeneration.from_pretrained(model_name)
- Use the following code to load the model and tokenizer:
-
Generate Questions:
- Execute the
run_model
function to generate questions from input text:def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output
- Execute the
-
Sample Execution:
- Run the sample inputs provided to see the question generation in action.
For enhanced performance, consider using cloud GPUs from providers like AWS, Google Cloud, or Azure to handle computational requirements efficiently.
License
The model and its usage are subject to the terms and conditions specified in its license agreement. Ensure compliance with the license when using this model for research or production purposes.