Instructions to use omarbayoumi2/smollm-135m-genqa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use omarbayoumi2/smollm-135m-genqa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="omarbayoumi2/smollm-135m-genqa") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("omarbayoumi2/smollm-135m-genqa") model = AutoModelForCausalLM.from_pretrained("omarbayoumi2/smollm-135m-genqa") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use omarbayoumi2/smollm-135m-genqa with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "omarbayoumi2/smollm-135m-genqa" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "omarbayoumi2/smollm-135m-genqa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/omarbayoumi2/smollm-135m-genqa
- SGLang
How to use omarbayoumi2/smollm-135m-genqa 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 "omarbayoumi2/smollm-135m-genqa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "omarbayoumi2/smollm-135m-genqa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "omarbayoumi2/smollm-135m-genqa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "omarbayoumi2/smollm-135m-genqa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use omarbayoumi2/smollm-135m-genqa with Docker Model Runner:
docker model run hf.co/omarbayoumi2/smollm-135m-genqa
π SmolLM-135M SQuAD v1.1 Generative Question Answering Model
Fine-tuned SmolLM-135M-Instruct on SQuAD v1.1 for English generative question answering.
This model takes a context paragraph and a question and generates a natural-language answer based on the text.
Unlike extractive QA models (e.g., BERT), this model does not select spansβit produces free-form answers using a causal language modeling head.
It is intended as a compact, educational example of fine-tuning a small (~135M parameter) generative LM for QA on Google Colab and deploying it on Hugging Face.
π Use Cases
- Educational demos of generative question answering
- Small QA systems over short English paragraphs
- Teaching / learning how to:
- convert extractive data to generative format
- fine-tune LMs with
Trainer - publish models + Spaces on Hugging Face
β οΈ Not intended for production-critical use (medical/legal/financial advice, etc.).
π§ Model Details
- Base model:
HuggingFaceTB/SmolLM-135M-Instruct - Architecture: Decoder-only Transformer with causal LM head
- Parameters: ~135M
- Task: Generative Question Answering
- Language: English
- Author:
omarbayoumi2 - Training platform: Google Colab (free GPU)
The model generates answers instead of choosing spans directly from the context.
π Training Data
- Dataset: SQuAD v1.1 (
rajpurkar/squad) - Domain: Wikipedia articles (encyclopedic text)
Each example was converted into a generative prompt:
context: paragraphquestion: question stringanswers:
Only answer tokens contribute to the training loss (prompt tokens masked with -100).
βοΈ Training Configuration
Fine-tuning was performed with the Hugging Face Trainer API.
- Objective: Causal LM
- Epochs: 2
- Learning rate: 2e-4
- Batch size: 8 (train), 8 (eval)
- Max sequence length: 256 tokens
- Weight decay: 0.01
- Padding strategy: Max length
- Mixed precision: FP16 (when GPU supports it)
Loss is computed over answer tokens only.
π Evaluation
Evaluation was performed on a subset of the SQuAD v1.1 validation set using extractive metrics:
- Exact Match (EM): strict text match
- F1 score: token-level overlap
Because outputs are generative rather than span-based, metrics may underestimate correctness.
| Metric | Score (approx) |
|---|---|
| Exact Match | ~1% |
| F1 | ~9% |
This model is optimized for educational usage, not leaderboard performance.
π How to Use
1. With Transformers pipeline
from transformers import pipeline
qa = pipeline(
"text-generation",
model="omarbayoumi2/smollm-135m-genqa",
)
context = "BERT is a language representation model developed by researchers at Google."
question = "Who developed BERT?"
prompt = f"Context: {context}\n\nQuestion: {question}\n\nAnswer:"
result = qa(prompt, max_new_tokens=64, do_sample=False)[0]["generated_text"]
print(result)
- Downloads last month
- 3