Whisper-Small-Khmer-Final-1500
This is checkpoint-3000 from phonsobon/Whisper-Small-Khmer-Final-v2, extracted and hosted as a standalone repo so it can be loaded directly for inference without pulling the rest of the training checkpoints.
- Base model:
openai/whisper-small - Fine-tuned for: Khmer automatic speech recognition (ASR)
- Source checkpoint:
checkpoint-3000ofWhisper-Small-Khmer-Final-v2
Usage
Install dependencies:
pip install transformers torch torchaudio librosa
Transcribe an audio file
import torch
import librosa
from transformers import WhisperProcessor, WhisperForConditionalGeneration
MODEL_ID = "phonsobon/Whisper-Small-Khmer-Final-3000"
AUDIO_PATH = "test_audio.wav"
device = "cuda" if torch.cuda.is_available() else "cpu"
processor = WhisperProcessor.from_pretrained(MODEL_ID)
model = WhisperForConditionalGeneration.from_pretrained(MODEL_ID).to(device)
model.eval()
audio, sr = librosa.load(AUDIO_PATH, sr=16000)
inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
input_features = inputs.input_features.to(device)
with torch.no_grad():
predicted_ids = model.generate(
input_features,
language="km",
task="transcribe",
max_new_tokens=444,
)
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
print("Transcription:", transcription)
Using the pipeline API (simpler)
from transformers import pipeline
asr = pipeline(
"automatic-speech-recognition",
model="phonsobon/Whisper-Small-Khmer-Final-3000",
)
result = asr("test_audio.wav", generate_kwargs={"language": "km", "task": "transcribe"})
print(result["text"])
Notes
- Input audio must be resampled to 16kHz mono — both examples above handle this via
librosa.load(..., sr=16000). - This repo contains only the files needed for inference (config, tokenizer/processor files, and model weights) — training artifacts like optimizer/scheduler state were intentionally excluded.
- For best results, test with a short (a few seconds to ~30s) clean Khmer audio clip first.