AI SeedbankHelp preserve open and free AI for humanity's future

← All models

kingabzpro_wav2vec2-large-xls-r-300m-Urdu

kingabzpro · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


language:

  • ur license: apache-2.0 tags:
  • generated_from_trainer
  • hf-asr-leaderboard
  • robust-speech-event datasets:
  • mozilla-foundation/common_voice_8_0 metrics:
  • wer
  • cer base_model: facebook/wav2vec2-xls-r-300m model-index:
  • name: wav2vec2-large-xls-r-300m-Urdu results:
    • task: type: automatic-speech-recognition name: Speech Recognition dataset: name: Common Voice 8 type: mozilla-foundation/common_voice_8_0 args: ur metrics:
      • type: wer value: 39.89 name: Test WER
      • type: cer value: 16.7 name: Test CER

new_version: kingabzpro/whisper-large-v3-turbo-urdu pipeline_tag: automatic-speech-recognition library_name: transformers

Urdu ASR XLS-R 300M

A fine-tuned XLS-R 300M CTC model for Urdu automatic speech recognition. It transcribes 16 kHz mono audio and includes an optional 5-gram KenLM decoder.

Best reported result: 39.89% WER / 16.70% CER with KenLM decoding on the Urdu Common Voice 8.0 test set. See the Kaggle evaluation notebook for a reproducible example.

⚡ Quick start

Install the required packages:

pip install -U torch torchaudio transformers pyctcdecode kenlm huggingface_hub

Note: After installing the packages in a notebook environment, restart the kernel before running the inference code.

Transcribe a local audio file:

import torch
import torchaudio
from transformers import AutoModelForCTC, AutoProcessor

MODEL_ID = "kingabzpro/wav2vec2-large-xls-r-300m-Urdu"
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
INFERENCE_DTYPE = torch.float16 if DEVICE.type == "cuda" else torch.float32

processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForCTC.from_pretrained(MODEL_ID).eval().to(
    device=DEVICE, dtype=INFERENCE_DTYPE
)

waveform, sample_rate = torchaudio.load("audio.wav")

# Convert stereo (or multi-channel) audio to mono and resample to 16 kHz.
waveform = waveform.mean(dim=0)
if sample_rate != 16_000:
    waveform = torchaudio.functional.resample(waveform, sample_rate, 16_000)

inputs = processor(
    waveform.numpy(), sampling_rate=16_000, return_tensors="pt", padding=True
).input_values.to(device=DEVICE, dtype=INFERENCE_DTYPE)

with torch.inference_mode():
    predicted_ids = model(inputs).logits.argmax(dim=-1)

transcription = processor.batch_decode(predicted_ids)[0]
print(transcription)

🧠 Language-model decoding

Why use it? The included 5-gram KenLM language model reduces the reported full-test WER from 56.07% (greedy CTC) to 39.89%.

Show the complete KenLM decoding example


The repository contains a 5-gram KenLM language model.

import json
import torch
import torchaudio
from huggingface_hub import hf_hub_download
from pyctcdecode import build_ctcdecoder
from transformers import AutoModelForCTC, AutoProcessor

MODEL_ID = "kingabzpro/wav2vec2-large-xls-r-300m-Urdu"
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
INFERENCE_DTYPE = torch.float16 if DEVICE.type == "cuda" else torch.float32

processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForCTC.from_pretrained(MODEL_ID).eval().to(
    device=DEVICE, dtype=INFERENCE_DTYPE
)

kenlm_path = hf_hub_download(MODEL_ID, "language_model/5gram.bin")
unigrams_path = hf_hub_download(MODEL_ID, "language_model/unigrams.txt")
attrs_path = hf_hub_download(MODEL_ID, "language_model/attrs.json")

with open(unigrams_path, encoding="utf-8") as file:
    unigrams = [line.strip() for line in file if line.strip()]
with open(attrs_path, encoding="utf-8") as file:
    attrs = json.load(file)

# Keep only acoustic tokens. The matching ID list is then applied to logits.
vocab_items = sorted(processor.tokenizer.get_vocab().items(), key=lambda item: item[1])
blank_id = processor.tokenizer.pad_token_id
delimiter = processor.tokenizer.word_delimiter_token
decoder_pairs = [
    (token, token_id)
    for token, token_id in vocab_items
    if token_id == blank_id or token == delimiter or len(token) == 1
]
kept_token_ids = [token_id for _, token_id in decoder_pairs]
labels = [
    "" if token_id == blank_id else " " if token == delimiter else token
    for token, token_id in decoder_pairs
]
decoder = build_ctcdecoder(
    labels,
    kenlm_model_path=kenlm_path,
    unigrams=unigrams,
    alpha=attrs.get("alpha", 0.5),
    beta=attrs.get("beta", 1.0),
)

waveform, sample_rate = torchaudio.load("audio.wav")
waveform = waveform.mean(dim=0)
if sample_rate != 16_000:
    waveform = torchaudio.functional.resample(waveform, sample_rate, 16_000)

inputs = processor(
    waveform.numpy(), sampling_rate=16_000, return_tensors="pt"
).input_values.to(device=DEVICE, dtype=INFERENCE_DTYPE)
with torch.inference_mode():
    logits = model(inputs).logits[0].float().cpu().numpy()

transcription = decoder.decode(logits[:, kept_token_ids])
print(transcription)

🧪 Kaggle evaluation

The Kaggle notebook evaluates a five-sample streaming smoke test from fixie-ai/common_voice_17_0 (ur, test).

Show the core evaluation code


from datasets import Audio, load_dataset

stream = load_dataset(
    "fixie-ai/common_voice_17_0", "ur", split="test", streaming=True
).cast_column("audio", Audio(sampling_rate=16_000))

example = next(iter(stream))
audio = example["audio"]
samples = audio.get_all_samples().data if hasattr(audio, "get_all_samples") else audio["array"]
waveform = samples.detach().cpu().numpy() if torch.is_tensor(samples) else samples
if waveform.ndim == 2:
    waveform = waveform.mean(axis=0 if waveform.shape[0] <= waveform.shape[-1] else 1)

inputs = processor(waveform, sampling_rate=16_000, return_tensors="pt")
with torch.inference_mode():
    logits = model(inputs.input_values.to(device=DEVICE, dtype=INFERENCE_DTYPE)).logits[0]

prediction = decoder.decode(logits.float().cpu().numpy()[:, kept_token_ids])
print("Reference: ", example["sentence"])
print("Prediction:", prediction)

Recorded notebook output

Single-sample inference:

Reference:  بے ذوق نہیں اگرچہ فطرت
Prediction: بھی ذوق نہیں اگھرچے فطرت

Five-sample streaming smoke-test results:

Sample Duration (s) WER CER
1 2.92 0.00% 0.00%
2 2.88 0.00% 0.00%
3 5.40 22.22% 3.03%
4 4.36 33.33% 12.50%
5 5.69 42.11% 24.00%
Mean 19.53% 7.91%

Important: This is a five-sample smoke test—not a benchmark. Do not compare it directly with the full Common Voice 8.0 test-set results below.

📊 Evaluation

Full Common Voice 8.0 test set

Decoder Test WER Test CER
Greedy CTC 56.07% 23.70%
5-gram language model 39.89% 16.70%

Results are reported on the Urdu test split of Mozilla Common Voice 8.0. The language-model row is the model-card score; compare each result only with the same decoding strategy.

To reproduce language-model evaluation from this repository:

python eval.py --model_id kingabzpro/wav2vec2-large-xls-r-300m-Urdu --dataset mozilla-foundation/common_voice_8_0 --config ur --split test

🏗️ Training

The model was trained from facebook/wav2vec2-xls-r-300m on Urdu Mozilla Common Voice 8.0.

Hyperparameter Value
Learning rate 1e-4
Train batch size 32
Evaluation batch size 8
Gradient accumulation 2
Effective train batch size 64
Epochs 200
LR scheduler Linear, 1,000 warm-up steps
Optimizer Adam (β₁=0.9, β₂=0.999, ε=1e-8)

Training checkpoints


Training loss Epoch Step Validation loss WER CER
3.6398 30.77 400 3.3517 1.0000 1.0000
2.9225 61.54 800 2.5123 1.0000 0.8310
1.2568 92.31 1,200 0.9699 0.6273 0.2575
0.8974 123.08 1,600 0.9715 0.5888 0.2457
0.7151 153.85 2,000 0.9984 0.5588 0.2353
0.6416 184.62 2,400 0.9889 0.5607 0.2370

⚠️ Intended use and limitations

Use this model for Urdu speech transcription and prototyping. Accuracy varies with recording quality, speaker accent, code-switching, background noise, domain-specific vocabulary, and utterance length. Review transcripts before using them in consequential or user-facing workflows.

Historical training environment


  • Transformers 4.17.0.dev0
  • PyTorch 1.10.2+cu102
  • Datasets 1.18.2.dev0
  • Tokenizers 0.11.0

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:ee3dbb51d60b25a7f9ff090961ce9ecf729642d5&dn=kingabzpro_wav2vec2-large-xls-r-300m-Urdu

Open magnet in torrent client · infohash ee3dbb51d60b25a7f9ff090961ce9ecf729642d5

Files & hashes

PathSizesha1sha256
5gram.arpa73.0 MB (76,535,773 B)8a3bd045fe0deeb1ae686791229f20dac9b58991e43e9614c504ebc5d38bf8e173fb8b1f08f19a0f49ffe32e799b876746fd5fdb
README.md8.8 KB (8,978 B)88b1dc9121f6796ec9a2c19d8d1783d1e1b75db0a9a4ae04c9aa0fe9e8337f6b26bd28ae9c03b555892e0a18a0584e429dda1087
added_tokens.json23 B (23 B)bf2d85738933bee4eace4db4f74c503e02b9170ed0b03b59c1165ace02a3d77a2d9123064b9f2b311d121327b71ae5b920c05aab
alphabet.json583 B (583 B)dc4570958c1f6ffecf3f1029a3e0e4593d12e4a61173a729d59c8e90db72b1e800d6ef1a383b6b3c8602b9c9f2b423ed1725abd6
attrs.json78 B (78 B)3c07595c2b465df3c14531dbc2d1c52bf11f166df5ffd02e1ceef6517476e72ebe7997ddef7e92d27cb5a23d6695d64c4317d6ad
config.json2.0 KB (2,063 B)b3fe5745a94f13262da1ae2176299f51bf12e9f6fa0fc7d0d227999b107bd94e6493cbf974e1162644c9bff5c0a187cb078b9a4f
eval.py5.3 KB (5,419 B)ddadef8c7d8953111a624ce82d4985eee420538398afb83daeb0ea195dc3035e4096042ddf67bc115347f3d54eb8867e8cb8b15d
language_model/5gram.bin70.2 MB (73,560,975 B)b7c42b153f7296f98fba29f64a8fc23612cf40b94f6488c3dec05fe326cd495b95a2a0655f8812c5e879bd7479b4b2fcec95e97b
language_model/attrs.json78 B (78 B)b1cf8c0b8c2705d8a340f97bb34d344031627f57b22725cd3e5f8e6a577c0cda519999dd6494d327928b53d553348e1a0f548880
language_model/unigrams.txt210.8 KB (215,891 B)3cf5412c62cd5acbe9f958005b7a43ec6398ab4f007b97aa2aa3caac8c71aedd7d4990bf7c8109e27cb4a3d0144417cd38d0675f
log_mozilla-foundation_common_voice_8_0_ur_test_predictions.txt21.8 KB (22,328 B)f75c56ee15069af04c281cb4f60a494f8e6996c03d9c7f5647025b8d02ef237014f3b48bf95779144a855bd41049fca904812dfb
log_mozilla-foundation_common_voice_8_0_ur_test_targets.txt22.6 KB (23,098 B)62ab5b3900f5bac91c233da898bf32ef2411e83ce0ef81139daed1ad785847df7ea160939b2982c4edc94037774079c56724ebeb
model.safetensors1.18 GB (1,262,041,132 B)d13ed1925067369df7ac20227a39355b73f00ea29281f8afcaaff6f9774595749c225cf30ab5a7377644eed35079e46c6d770cfd
mozilla-foundation_common_voice_8_0_ur_test_eval_results.txt49 B (49 B)256add1dbb1a41bcff1f8888d3a0855daf201590fc0e26b76b32f29f0663b442f34baadb6fcc6da3ac30f8bec5c26b1b83326010
preprocessor_config.json262 B (262 B)9f99bcabcbeaf80e6791d79c9cb6cd68c6e7ae952c594304e9d9832162bedd5345051df29e8daf458a845cbed58c6ede23ceeae3
special_tokens_map.json502 B (502 B)9f67b8850653ed23d13b34d2f96f2b7b62ea4876a8d4108744f9b30c57365da221c760137c262a6ddfa4a71a9a68a561d7b842ee
tokenizer_config.json345 B (345 B)72cd622dce4dba5ab7bd23d6036ea5a1a776e168483c7cc5f2c7af7d3e70fdc8b4f7a457c71d8dc10e0609d9b454a5261764e6ee
training_args.bin3.0 KB (3,055 B)d0ff7c8e3aa88cd9228091a7b4058dd9fe6ce7b58f3fdb9fc7e9d2f050e7fe97a99dfe830e2597415814ee8638e4d955fe40fac8
unigrams.txt267.7 KB (274,102 B)ac19f0bbe1d79f7f260a0668c327bc7761231baa9d46c112978f512bfdeb32a34b9097c5d1f0c86e14f9cce17466fe0367ae1d3e
vocab.json545 B (545 B)403d4cf1a9e06482bd7db8da0e25ca39f7e4f646499859ef03821002ac7c2ed73c8dd3705709a82cd2070b0426e1663c0c2f7350

Cite this release

Canonical URL
https://aiseedbank.org/models/kingabzpro_wav2vec2-large-xls-r-300m-Urdu/
Slug
kingabzpro_wav2vec2-large-xls-r-300m-Urdu
Infohash
ee3dbb51d60b25a7f9ff090961ce9ecf729642d5
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: kingabzpro_wav2vec2-large-xls-r-300m-Urdu.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorykingabzpro/wav2vec2-large-xls-r-300m-Urdu
Revision (pinned)18a6595fc0cc4d9c63fc8d0407b5596f09c49edb
Fetched at2026-09-04T01:13:33Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T01:13:49Z

apache-2.01.32 GB (1,412,695,279 bytes)transformerssafetensorswav2vec2automatic-speech-recognitiongenerated_from_trainerhf-asr-leaderboardrobust-speech-eventmodel-indexendpoints_compatible1 language (ur)