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")# pip install -U transformers accelerate # 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", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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
Download README.md from fares7elsadek/boolq-t5-base-question-generation: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/fares7elsadek/boolq-t5-base-question-generation/resolve/main/README.md
- Command line
-
hf download hf://fares7elsadek/boolq-t5-base-question-generation/README.md
-
curl -L -o README.md https://huggingface.co/fares7elsadek/boolq-t5-base-question-generation/resolve/main/README.md
license: mit
datasets:
- google/boolq
language:
- en
metrics:
- bleu
base_model:
- google-t5/t5-base
pipeline_tag: text2text-generation
tags:
- question-generation
- education
- code
- boolean-questions
- text-generation-inference
library_name: transformers
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)