gagan3012_wav2vec2-xlsr-khmer
gagan3012 · View on Hugging Face ↗
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: km datasets:
- OpenSLR
- common_voice metrics:
- wer tags:
- audio
- automatic-speech-recognition
- speech
- xlsr-fine-tuning-week license: apache-2.0 model-index:
- name: wav2vec2-xlsr-Khmer by Gagan Bhatia
results:
- task:
name: Speech Recognition
type: automatic-speech-recognition
dataset:
name: OpenSLR km
type: OpenSLR
args: km
metrics:
- name: Test WER type: wer value: 24.96
- task:
name: Speech Recognition
type: automatic-speech-recognition
dataset:
name: OpenSLR km
type: OpenSLR
args: km
metrics:
Wav2Vec2-Large-XLSR-53-khmer
Fine-tuned facebook/wav2vec2-large-xlsr-53 on Khmer using the Common Voice, and OpenSLR Kh.
When using this model, make sure that your speech input is sampled at 16kHz.
Usage
The model can be used directly (without a language model) as follows:
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
!wget https://www.openslr.org/resources/42/km_kh_male.zip
!unzip km_kh_male.zip
!ls km_kh_male
colnames=['path','sentence']
df = pd.read_csv('/content/km_kh_male/line_index.tsv',sep='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\t',header=None,names = colnames)
df['path'] = '/content/km_kh_male/wavs/'+df['path'] +'.wav'
train, test = train_test_split(df, test_size=0.1)
test.to_csv('/content/km_kh_male/line_index_test.csv')
test_dataset = load_dataset('csv', data_files='/content/km_kh_male/line_index_test.csv',split = 'train')
processor = Wav2Vec2Processor.from_pretrained("gagan3012/wav2vec2-xlsr-nepali")
model = Wav2Vec2ForCTC.from_pretrained("gagan3012/wav2vec2-xlsr-nepali")
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def speech_file_to_array_fn(batch):
\\\\\\\\\\\\\\\\tspeech_array, sampling_rate = torchaudio.load(batch["path"])
\\\\\\\\\\\\\\\\tbatch["speech"] = resampler(speech_array).squeeze().numpy()
\\\\\\\\\\\\\\\\treturn batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
\\\\\\\\\\\\\\\\tlogits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
predicted_ids = torch.argmax(logits, dim=-1)
print("Prediction:", processor.batch_decode(predicted_ids))
print("Reference:", test_dataset["sentence"][:2])
Result
Prediction: ['पारानाको ब्राजिली राज्यमा रहेको राजधानी', 'देवराज जोशी त्रिभुवन विश्वविद्यालयबाट शिक्षाशास्त्रमा स्नातक हुनुहुन्छ']
Reference: ['पारानाको ब्राजिली राज्यमा रहेको राजधानी', 'देवराज जोशी त्रिभुवन विश्वविद्यालयबाट शिक्षाशास्त्रमा स्नातक हुनुहुन्छ']
Evaluation
The model can be evaluated as follows on the {language} test data of Common Voice. # TODO: replace #TODO: replace language with your {language}, e.g. French
import torch
import torchaudio
from datasets import load_dataset, load_metric
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import re
from sklearn.model_selection import train_test_split
import pandas as pd
from datasets import load_dataset
!wget https://www.openslr.org/resources/42/km_kh_male.zip
!unzip km_kh_male.zip
!ls km_kh_male
colnames=['path','sentence']
df = pd.read_csv('/content/km_kh_male/line_index.tsv',sep='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\t',header=None,names = colnames)
df['path'] = '/content/km_kh_male/wavs/'+df['path'] +'.wav'
train, test = train_test_split(df, test_size=0.1)
test.to_csv('/content/km_kh_male/line_index_test.csv')
test_dataset = load_dataset('csv', data_files='/content/km_kh_male/line_index_test.csv',split = 'train')
wer = load_metric("wer")
cer = load_metric("cer")
processor = Wav2Vec2Processor.from_pretrained("gagan3012/wav2vec2-xlsr-khmer")
model = Wav2Vec2ForCTC.from_pretrained("gagan3012/wav2vec2-xlsr-khmer")
model.to("cuda")
chars_to_ignore_regex = '[\\\\,\\\\?\\\\.\\\\!\\\\-\\\\;\\\\:\\\\"\\\\“]'
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def speech_file_to_array_fn(batch):
\\tbatch["text"] = re.sub(chars_to_ignore_regex, '', batch["text"]).lower()
\\tspeech_array, sampling_rate = torchaudio.load(batch["path"])
\\tbatch["speech"] = resampler(speech_array).squeeze().numpy()
\\treturn batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def evaluate(batch):
\\tinputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
\\twith torch.no_grad():
\\t\\tlogits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits
\\tpred_ids = torch.argmax(logits, dim=-1)
\\tbatch["pred_strings"] = processor.batch_decode(pred_ids)
\\treturn batch
cer = load_metric("cer")
result = test_dataset.map(evaluate, batched=True, batch_size=8)
print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["text"])))
print("CER: {:2f}".format(100 * cer.compute(predictions=result["pred_strings"], references=result["text"])))
Test Result: 24.96 %
WER: 24.962519 CER: 6.950925
Training
The script used for training can be found here
Magnet link
Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:
magnet:?xt=urn:btih:d65b3e2011277aac379daa3e912a91ae171606b7&dn=gagan3012_wav2vec2-xlsr-khmerOpen magnet in torrent client · infohash d65b3e2011277aac379daa3e912a91ae171606b7
Files & hashes
| Path | Size | sha1 | sha256 |
|---|---|---|---|
| README.md | 5.7 KB (5,863 B) | 4d5f5db75eb598f3128f5a81a0bd27433fdca8fa | 820f21de8cd21d6afd4e7df9095088af6db1d0d0224801b7441890ae7bdaafb4 |
| config.json | 1.5 KB (1,558 B) | 848a3da6caf24abe79fb72d914888a09cf7bb51a | 9e2dd4bf489b9c9bb5501710fbd390d1b917039a243c76b52bdcdfa40cb9ab45 |
| optimizer.pt | 2.32 GB (2,490,675,719 B) | 7dee860339bef8d9774d3efc3b03d070aa6a8748 | 915f39749bdd822f47e68c0477d435a9fd7760c3d590bf63ba9e86e802c006e8 |
| preprocessor_config.json | 158 B (158 B) | 0886a48276922a77013d8aa4681192138ae90d90 | c403ce09975b90dff0dd8302c42d422e9de1f166cd7772df23490069893cb0cf |
| pytorch_model.bin | 1.18 GB (1,262,233,111 B) | 9e9a5ff5942555712a0c1754a5c1068c34c87504 | 835850a7a029e73a8fa6113cd193085d0e470700c4bb45be4e41f630bc8afe34 |
| scheduler.pt | 623 B (623 B) | 6bc398b9d7a52c4c8ef718bc7147392d527c4cc0 | 90a4b7dd943e4433a60f796edbc9ed88f16bd4c3bd4609e41aaaaf622ba391cb |
| special_tokens_map.json | 85 B (85 B) | 9abf71998c3e0de2f13c0fd73ed81477c9dae118 | 50eb73d51191696209d30d42d6ede50e57e7a542ca1db12df714b2c0aa3da8e2 |
| tokenizer_config.json | 138 B (138 B) | a2a8340e0a162e4e223867107d9db359f5697c1d | 3160c256a4d10e1fc5133a2d318e63406cc382b957563198931c8a90f9b9242d |
| trainer_state.json | 1.6 KB (1,664 B) | 668dc73863e889a67b348e2d840ec087cb264bc5 | c43dd8b9168db5af023159ea0262e506292abf4fc3f00a12284053b3a9d424b6 |
| training_args.bin | 2.2 KB (2,287 B) | 23f37dca2fc2f7b4a675c2e7711546eb5e2e2115 | b9eb3b3eafe5ebea11421306fb6d11ffc66297eddda9495cddcfd0a7770a2b8e |
| vocab.json | 795 B (795 B) | 86aab594cca6588fd49777efa31d861e4347f8d2 | 16506082310fa1393e0187c1e901ac70d891a230b5b5c1fd3041d7c9f89e971c |
Cite this release
- Canonical URL
- https://aiseedbank.org/models/gagan3012_wav2vec2-xlsr-khmer/
- Slug
- gagan3012_wav2vec2-xlsr-khmer
- Infohash
- d65b3e2011277aac379daa3e912a91ae171606b7
- License
- apache-2.0
- Signing key fingerprint
- 85a3b32c3712427b
Every file carries a locally computed sha256 — verify a download against the signed sums: gagan3012_wav2vec2-xlsr-khmer.SHA256SUMS (+ minisign signature).
Provenance
| Upstream repository | gagan3012/wav2vec2-xlsr-khmer |
|---|---|
| Revision (pinned) | 2b626a577ac629a05d1ab01ac5ba3ad14740de54 |
| Fetched at | 2026-09-03T23:02:55Z |
| License at fetch | apache-2.0 |
| Snapshot tool | huggingface · seedbank 0.1.0 |
Trackers
- udp://announce.aitorrent.org:6969/announce
- http://announce.aitorrent.org:7070/announce
- udp://announce2.aitorrent.org:6970/announce
- http://announce2.aitorrent.org:7071/announce
- udp://tracker.opentrackr.org:1337/announce
- udp://open.demonii.com:1337/announce
- udp://open.stealth.si:80/announce
- udp://exodus.desync.com:6969/announce
- udp://tracker.torrent.eu.org:451/announce
✓ verified · rehash-vs-hf-metadata at 2026-09-03T23:03:33Z
apache-2.03.50 GB (3,752,922,001 bytes)transformerspytorchjaxwav2vec2automatic-speech-recognitionaudiospeechxlsr-fine-tuning-weekmodel-indexendpoints_compatible1 language (km)