Downloads · 30 days
14
18% of all-time downloads
Blaqadonis/Qwen2.5-0.5B-Nigerian-News-Headlines
Qwen2.5-0.5B-Nigerian-News-Headlines is a text generation model from Blaqadonis. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Fine-tuned Qwen 2.5 0.5B Instruct model for generating compelling headlines from Nigerian news articles using QLoRA (Quantized Low-Rank Adaptation).
Downloads · 30 days
14
18% of all-time downloads
All-time downloads
77
Public
Parameters
505M
741 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors730 MB · 98%
How the weights are stored.
U8369M · 73%
From the Hugging Face model README
Fine-tuned Qwen 2.5 0.5B Instruct model for generating compelling headlines from Nigerian news articles using QLoRA (Quantized Low-Rank Adaptation).
This model adapts the lightweight Qwen 2.5 0.5B Instruct base model to generate concise, informative headlines specifically for Nigerian news content. It was fine-tuned using parameter-efficient QLoRA on over 4,000 Nigerian news articles from AriseTv.
Each sample consists of:
Hardware:
Hyperparameters:
# Model Configuration
base_model: Qwen/Qwen2.5-0.5B-Instruct
sequence_length: 512
# QLoRA Configuration
quantization: 4-bit NF4
lora_r: 8
lora_alpha: 16
lora_dropout: 0.05
target_modules: [q_proj, v_proj]
# Training Parameters
num_epochs: 2
max_steps: 300
batch_size: 16
gradient_accumulation_steps: 2
learning_rate: 2e-4
lr_scheduler: cosine
warmup_steps: 50
optimizer: paged_adamw_8bit
bf16: true
Trainable Parameters:
| Metric | Value |
|---|---|
| Final Training Loss | 2.4179 |
| Final Validation Loss | 2.5533 |
| Training Time | ~18 minutes |
| GPU Memory Usage | ~12GB |
Training Curve:
Evaluated on 200 held-out Nigerian news samples:
| Metric | Baseline (Zero-shot) | Fine-tuned | Improvement |
|---|---|---|---|
| ROUGE-1 | 27.16% | 31.81% | +17.13% |
| ROUGE-2 | 8.23% | 11.59% | +40.78% |
| ROUGE-L | 22.26% | 28.46% | +27.88% |
✅ Significant improvements across all metrics
✅ Better headline quality
Excerpt:
Lewis Hamilton was gracious in defeat after Red Bull rival Max Verstappen ended
the Briton's quest for an unprecedented eighth...
Reference: F1: Hamilton Gracious in Title Defeat as Mercedes Lodge Protests
Baseline: Lewis Hamilton's Gracious Victory After Red Bull's Max Verstappen Seeks Record-Setting Eighth Win
Fine-tuned: Hamilton Gracious After Red Bull Victory ✅
Excerpt:
Following improved corporate earnings by companies, low yield in fixed income
market, among other factors, the stock market segment of...
Reference: Nigeria's Stock Market Sustains Bullish Trend, Gains N5.64trn in First Half 2022
Baseline: "Boosting Corporate Profits: The Impact on Stock Market Performance Amidst Yield Challenges"
Fine-tuned: Nigeria's Stock Market Suffers as Corporate Earnings Slow ✅
Excerpt:
Amidst the worsening insecurity in the country, governors elected on the platform
of the Peoples Democratic Party (PDP) on Wednesday...
Reference: Nigeria: PDP Governors Restate Case for Decentralised Police
Baseline: "Governors Rally to Defend Statehood Amidst Growing Security Concerns"
Fine-tuned: Nigeria: PDP Governors Elected Amidst Worsening Security Crisis ✅
pip install transformers peft torch bitsandbytes accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
import torch
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
# Configure 4-bit quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16
)
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-0.5B-Instruct",
quantization_config=bnb_config,
device_map="auto",
torch_dtype=torch.bfloat16
)
# Load LoRA adapters
model = PeftModel.from_pretrained(
base_model,
"Blaqadonis/Qwen2.5-0.5B-Nigerian-News-Headlines"
)
model.eval()
def generate_headline(news_excerpt):
"""Generate headline from news excerpt."""
prompt = f"""Generate a concise and engaging headline for the following Nigerian news excerpt.
## News Excerpt:
{news_excerpt}
## Headline:"""
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=50,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Extract only the generated headline
headline = response.split("## Headline:")[-1].strip()
return headline
# Example usage
excerpt = """
Nigeria's inflation rate has risen to 33.40% in July 2024,
according to the National Bureau of Statistics...
"""
headline = generate_headline(excerpt)
print(headline)
# Output: "Nigeria's Inflation Rate Rises to 33.40% in July 2024"
from transformers import pipeline
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Generate headline
prompt = """Generate a concise and engaging headline for the following Nigerian news excerpt.
## News Excerpt:
The Central Bank of Nigeria has announced new forex policies...
## Headline:"""
output = pipe(prompt, max_new_tokens=50, do_sample=False)
print(output[0]['generated_text'])
⚠️ Important Notes:
If you use this model in your work, please cite:
@misc{qwen25-nigerian-headlines,
author = {Blaqadonis},
title = {Qwen2.5-0.5B-Nigerian-News-Headlines: Fine-tuned Model for Nigerian News Headline Generation},
year = {2024},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Blaqadonis/Qwen2.5-0.5B-Nigerian-News-Headlines}}
}
Model Version: 1.0
Last Updated: December 2025
Model Card Version: 1.0