Instructions to use fares7elsadek/boolq-t5-base-question-generation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fares7elsadek/boolq-t5-base-question-generation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fares7elsadek/boolq-t5-base-question-generation")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("fares7elsadek/boolq-t5-base-question-generation") model = AutoModelForSeq2SeqLM.from_pretrained("fares7elsadek/boolq-t5-base-question-generation") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use fares7elsadek/boolq-t5-base-question-generation with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fares7elsadek/boolq-t5-base-question-generation" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fares7elsadek/boolq-t5-base-question-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/fares7elsadek/boolq-t5-base-question-generation
- SGLang
How to use fares7elsadek/boolq-t5-base-question-generation with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "fares7elsadek/boolq-t5-base-question-generation" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fares7elsadek/boolq-t5-base-question-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "fares7elsadek/boolq-t5-base-question-generation" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fares7elsadek/boolq-t5-base-question-generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use fares7elsadek/boolq-t5-base-question-generation with Docker Model Runner:
docker model run hf.co/fares7elsadek/boolq-t5-base-question-generation
YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
BoolQ T5
This repository contains a T5-base model fine-tuned on the BoolQ dataset for generating true/false question-answer pairs. Leveraging T5’s text-to-text framework, the model can generate natural language questions and their corresponding yes/no answers directly from a given passage.
Model Overview
Built with PyTorch Lightning, this implementation streamlines training, validation, and hyperparameter tuning. By adapting the pre-trained T5-base model to the task of question generation and answer prediction, it effectively bridges comprehension and generation in a single framework.
Data Processing
Input Construction
Each input sample is formatted as follows:
truefalse: [answer] passage: [passage] </s>
Target Construction
Each target sample is formatted as:
question: [question] answer: [yes/no] </s>
The boolean answer is normalized to “yes” or “no” to ensure consistency during training.
Training Details
- Framework: PyTorch Lightning
- Optimizer: AdamW with linear learning rate scheduling and warmup
- Batch Sizes:
- Training: 6
- Evaluation: 6
- Maximum Sequence Length: 256 tokens
- Number of Training Epochs: 4
Evaluation Metrics
The model’s performance was evaluated using BLEU scores for both the generated questions and answers. For question generation, the metrics are as follows:
| Metric | Question |
|---|---|
| BLEU-1 | 0.5143 |
| BLEU-2 | 0.3950 |
| BLEU-3 | 0.3089 |
| BLEU-4 | 0.2431 |
Note: These metrics offer a quantitative assessment of the model’s quality in generating coherent and relevant question-answer pairs.
How to Use
You can easily utilize this model for inference using the Hugging Face Transformers pipeline:
from transformers import pipeline
generator = pipeline("text2text-generation", model="Fares7elsadek/boolq-t5-base-question-generation")
# Example inference:
input_text = "truefalse: [answer] passage: [Your passage here] </s>"
result = generator(input_text)
print(result)
- Downloads last month
- 6
Model tree for fares7elsadek/boolq-t5-base-question-generation
Base model
google-t5/t5-base