sajjadiba/urdu-asr-error-correction-qwen3-4b
018
Urdu ASR Error Correction (Qwen3-4B 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: Qwen/Qwen3-4B-Instruct-2507
- 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 = "Qwen/Qwen3-4B-Instruct-2507"
adapter_id = "your-username/urdu-asr-error-correction-qwen3-4b"
# 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}
}