phonsobon/khmer-speech-dataset
Viewer โข Updated โข 450k โข 4.24k
This is a fine-tuned version of openai/whisper-base for automatic speech recognition (ASR) on the Khmer language.
openai/whisper-basephonsobon/khmer-speech-datasettranscribekm)โ ๏ธ Status: experimental / under evaluation. This checkpoint is uploaded for testing. Word Error Rate (WER) and other evaluation numbers have not been finalized yet.
from transformers import WhisperProcessor, WhisperForConditionalGeneration
import torch
import torchaudio
repo_id = "phonsobon/whisper-base-khmer-finetune"
processor = WhisperProcessor.from_pretrained(repo_id)
model = WhisperForConditionalGeneration.from_pretrained(repo_id)
# Force Khmer transcription (not translation)
forced_decoder_ids = processor.get_decoder_prompt_ids(language="khmer", task="transcribe")
# Load an audio file (mono, resampled to 16kHz)
waveform, sr = torchaudio.load("your_audio.wav")
if sr != 16000:
waveform = torchaudio.functional.resample(waveform, sr, 16000)
inputs = processor(waveform.squeeze().numpy(), sampling_rate=16000, return_tensors="pt")
with torch.no_grad():
predicted_ids = model.generate(inputs["input_features"], forced_decoder_ids=forced_decoder_ids)
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
print(transcription[0])
pipeline API
from transformers import pipeline
asr = pipeline(
"automatic-speech-recognition",
model="phonsobon/whisper-base-khmer-finetune",
generate_kwargs={"language": "khmer", "task": "transcribe"},
)
result = asr("your_audio.wav")
print(result["text"])
Seq2SeqTraineroptimizer.pt, scheduler.pt, rng_state.pth, scaler.pt, trainer_state.json, training_args.bin) is intentionally excluded from this repo โ only the files needed for inference are included.Built as part of Khmer language technology tooling for the Chaktomuk Managements (CTM) system under Cambodia's Ministry of Post and Telecommunications, Digital Transformation Working Group.
Base model
openai/whisper-base