CoolFace
Modelpublic

Pirnazar/whisper-large-v3-turbo-turkmen-lora

sourceHugging Facecc-by-nc-4.0updated 4d agoView on Hugging Face
0likes18downloads
Model Card

Turkmen Whisper — LoRA adapter

Turkmen speech recognition fine-tune shared by Pirnazar. This repository contains the trained LoRA adapter (about 6.6 MB), plus the processor and tokenizer. The base model is downloaded separately on first use.

Usage

bash
pip install "transformers==5.17.0" "peft==0.21.0" torch soundfile scipy
python
import math
import torch
import soundfile as sf
from scipy.signal import resample_poly
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
from peft import PeftModel

repo = "Pirnazar/whisper-large-v3-turbo-turkmen-lora"
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.float16 if device == "cuda" else torch.float32
processor = AutoProcessor.from_pretrained(repo)
base = AutoModelForSpeechSeq2Seq.from_pretrained(
    "openai/whisper-large-v3-turbo", dtype=dtype,
)
model = PeftModel.from_pretrained(base, repo).merge_and_unload().to(device).eval()
audio, sr = sf.read("audio.wav", dtype="float32")
if audio.ndim == 2:
    audio = audio.mean(axis=1)
if sr != 16000:
    divisor = math.gcd(sr, 16000)
    audio = resample_poly(audio, 16000 // divisor, sr // divisor)
if len(audio) > 30 * 16000:
    raise ValueError("Split recordings into clips of at most 30 seconds for this example.")
inputs = processor(audio, sampling_rate=16000, return_tensors="pt", return_attention_mask=True)
model.generation_config.forced_decoder_ids = None
with torch.inference_mode():
    ids = model.generate(
        inputs.input_features.to(device=device, dtype=dtype),
        attention_mask=inputs.attention_mask.to(device),
        language="tk", task="transcribe", return_timestamps=False,
    )
print(processor.batch_decode(ids, skip_special_tokens=True)[0])

Training and recorded evaluation

  • —Base: OpenAI Whisper large-v3-turbo.
  • —Data: mamed0v/TurkmenSpeech.
  • —LoRA: rank 8, alpha 16, dropout 0.05, targeting q_proj and v_proj.
  • —Exported checkpoint: step 20,565, epoch 3.
  • —Recorded training-time validation on 500 examples: WER 29.51%, CER 6.59%.

These are validation metrics, not an independent test-set benchmark. Performance on noisy, mixed-language or out-of-domain audio is not established. Review important transcripts for errors and hallucinations. Training did not use timestamp tokens: use Turkmen transcription with timestamp generation disabled.

License and attribution

This fine-tuned release is distributed for non-commercial use under CC BY-NC 4.0. Training data is published by mamed0v under CC BY-NC 4.0. The base OpenAI Whisper model is MIT-licensed; see LICENSE-WHISPER. Credit OpenAI, mamed0v/TurkmenSpeech and Pirnazar when redistributing, and indicate modifications. This is a community fine-tune, not an official OpenAI release.