Text Generation
PEFT
Safetensors
Transformers
Urdu
lora
sft
trl
urdu
asr-error-correction
speech-recognition
conversational
Instructions to use sajjadiba/urdu-asr-error-correction-tiny-aya-fire with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use sajjadiba/urdu-asr-error-correction-tiny-aya-fire with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-fire") model = PeftModel.from_pretrained(base_model, "sajjadiba/urdu-asr-error-correction-tiny-aya-fire") - Transformers
How to use sajjadiba/urdu-asr-error-correction-tiny-aya-fire with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sajjadiba/urdu-asr-error-correction-tiny-aya-fire") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sajjadiba/urdu-asr-error-correction-tiny-aya-fire", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sajjadiba/urdu-asr-error-correction-tiny-aya-fire with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sajjadiba/urdu-asr-error-correction-tiny-aya-fire" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sajjadiba/urdu-asr-error-correction-tiny-aya-fire", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sajjadiba/urdu-asr-error-correction-tiny-aya-fire
- SGLang
How to use sajjadiba/urdu-asr-error-correction-tiny-aya-fire 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 "sajjadiba/urdu-asr-error-correction-tiny-aya-fire" \ --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": "sajjadiba/urdu-asr-error-correction-tiny-aya-fire", "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 "sajjadiba/urdu-asr-error-correction-tiny-aya-fire" \ --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": "sajjadiba/urdu-asr-error-correction-tiny-aya-fire", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sajjadiba/urdu-asr-error-correction-tiny-aya-fire with Docker Model Runner:
docker model run hf.co/sajjadiba/urdu-asr-error-correction-tiny-aya-fire
Urdu ASR Error Correction (Tiny-Aya-Fire LoRA Adapter)
This repository contains fine-tuned LoRA adapter weights for post-ASR error correction and sentence segmentation of Urdu transcripts generated by openai/whisper-large-v3-turbo.
- Base Model: CohereLabs/tiny-aya-fire
- Dataset: urdu-asr-error-correction-data
- License: CC BY-NC 4.0
Quickstart / Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model_id = "CohereLabs/tiny-aya-fire"
adapter_id = "your-username/urdu-asr-error-correction-tiny-aya-fire"
# Load Base Model & Tokenizer
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load Fine-Tuned Adapter
model = PeftModel.from_pretrained(base_model, adapter_id)
# Zero-Shot Prompt format as defined in the paper
ZERO_SHOT_PROMPT = """Task: Correct Urdu ASR errors.
Rules:
1. Fix ONLY spelling and character errors.
2. Keep correct words EXACTLY as is --- DO NOT rewrite or paraphrase.
3. DO NOT add any notes, explanations, or markers.
4. STOP immediately after the corrected sentence.
Input: {input_text}
Corrected:"""
# Example Raw ASR Output from Whisper
raw_asr_input = "آپ کا ان پٹ اردو جملہ یہاں درج کریں"
prompt = ZERO_SHOT_PROMPT.format(input_text=raw_asr_input)
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Citation
If you use this model adapter in your research, please cite our paper:
@inproceedings{haider2026improving,
title={Improving Urdu ASR with Fine-Tuned Small Language Models for Post-ASR Error Correction},
author={Haider, Sajjad and Shaikh, Solat Jabeen and Aqib, Zuha and Inayat, Farah and Ahmed, Zehra},
booktitle={Proceedings of the 2nd Workshop on Speech and Audio Language Models (SALMA @ EMNLP 2026)},
year={2026}
organization={Artificial Intelligence Lab, Department of Computer Science, Institute of Business Administration (IBA), Karachi, Pakistan}
}
- Downloads last month
- 36