Downloads · 30 days
16
23% of all-time downloads
sparshrestha/finetuned-whisper-small-nepali-ct2
finetuned-whisper-small-nepali-ct2 is a machine learning model from sparshrestha. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is a fine-tuned version of openai/whisper-small for Nepali automatic speech recognition.
Downloads · 30 days
16
23% of all-time downloads
All-time downloads
71
Public
Repo size
484 MB
Likes
0
Public
Click a slice to open those files.
.bin484 MB · 99%
From the Hugging Face model README
This model is a fine-tuned version of openai/whisper-small for Nepali automatic speech recognition.
The model is intended for Nepali speech-to-text transcription and is part of a larger Nepali speech processing pipeline that can later support:
Nepali speech → Nepali text → punctuation restoration → machine translation → English text/speech
openai/whisper-smallneThe model was fine-tuned using a combination of publicly available Nepali speech datasets:
Mozilla Common Voice 26.0
ne-NPGoogle FLEURS
ne_npThe datasets were normalized into a shared schema:
audio
sentence
source
Audio was resampled to 16 kHz. Text was Unicode-normalized and lightly cleaned before Whisper feature extraction.
from transformers import pipeline
pipe = pipeline(
"automatic-speech-recognition",
model="sparshrestha/finetuned-whisper-small-nepali",
generate_kwargs={
"language": "nepali",
"task": "transcribe",
},
)
text = pipe("audio.wav")["text"]
print(text)
import torch
from transformers import pipeline
device = 0 if torch.cuda.is_available() else -1
pipe = pipeline(
"automatic-speech-recognition",
model="sparshrestha/finetuned-whisper-small-nepali",
device=device,
generate_kwargs={
"language": "nepali",
"task": "transcribe",
},
)
text = pipe("audio.wav")["text"]
print(text)
import torch
import gradio as gr
from transformers import pipeline
device = 0 if torch.cuda.is_available() else -1
pipe = pipeline(
"automatic-speech-recognition",
model="sparshrestha/finetuned-whisper-small-nepali",
device=device,
generate_kwargs={
"language": "nepali",
"task": "transcribe",
},
)
def transcribe(audio):
if audio is None:
return ""
return pipe(audio)["text"]
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(
sources=["microphone", "upload"],
type="filepath",
),
outputs="text",
title="Whisper Small Nepali",
description="Demo for Nepali speech recognition using a fine-tuned Whisper small model.",
)
iface.launch(share=True)
For faster inference, this model can be converted to CTranslate2 format.
pip install faster-whisper ctranslate2
ct2-transformers-converter \
--model sparshrestha/finetuned-whisper-small-nepali \
--output_dir finetuned-whisper-small-nepali-ct2 \
--copy_files tokenizer.json preprocessor_config.json \
--quantization float16
from faster_whisper import WhisperModel
model = WhisperModel(
"finetuned-whisper-small-nepali-ct2",
device="cuda",
compute_type="float16",
)
segments, info = model.transcribe(
"audio.wav",
language="ne",
task="transcribe",
beam_size=5,
)
text = " ".join(segment.text.strip() for segment in segments)
print(text)
from faster_whisper import WhisperModel
model = WhisperModel(
"finetuned-whisper-small-nepali-ct2",
device="cuda",
compute_type="int8_float16",
)
segments, info = model.transcribe(
"audio.wav",
language="ne",
task="transcribe",
beam_size=5,
)
text = " ".join(segment.text.strip() for segment in segments)
print(text)