Downloads · 30 days
5
0% of all-time downloads
anuran-roy/pratilekha-v0-small
pratilekha-v0-small is a machine learning model from anuran-roy. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
<center<img src="https://cdn-uploads.huggingface.co/production/uploads/6321f93e15b7beab57c4f631/z58wTlxOgYCxykYwQM41J.png" /</center
Downloads · 30 days
5
0% of all-time downloads
All-time downloads
8.1K
Public
Repo size
469 MB
Likes
2
Public
Click a slice to open those files.
.pt312 MB · 59%
From the Hugging Face model README
hi), English (en), Bengali (bn), Tamil (ta), Telugu (te), Marathi (mr), Gujarati (gu), Kannada (kn), Malayalam (ml), Punjabi (pa), Urdu (ur), Odia (or)The model can be used directly for speech-to-text transcription of Indic language audio files. It supports both explicit language specification and automatic language detection. Inputs are taken at 16 kHz frequency (pcm16)
The model can be integrated into voice agent pipelines, real-time transcription services, or any application requiring Indic language speech recognition. A WebSocket-based FastAPI server is provided for real-time inference.
import torch
from transformers import WhisperProcessor, WhisperForConditionalGeneration
from peft import PeftModel
import librosa
from typing import Optional
def load_finetuned_model(
adapter_path: str = "whisper-indic-voice-agent-small",
base_model: str = "openai/whisper-small"
):
"""Load the fine-tuned Whisper model with LoRA adapters"""
processor = WhisperProcessor.from_pretrained(adapter_path)
model = WhisperForConditionalGeneration.from_pretrained(
base_model,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter_path)
model.eval()
return model, processor
# Load model
model, processor = load_finetuned_model()
# Load audio
audio, sr = librosa.load("path/to/audio.wav", sr=16000)
# Process and transcribe
input_features = processor(
audio, sampling_rate=16000, return_tensors="pt"
).input_features.to(model.device, dtype=torch.float16)
with torch.no_grad():
predicted_ids = model.generate(
input_features,
max_length=448,
language="hi", # Set to None for auto-detection
task="transcribe"
)
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
print(f"Transcription: {transcription}")
A FastAPI-based WebSocket server is included for real-time transcription:
python server.py
The server exposes:
GET /health — Health check endpoint.WS /ws/transcribe — WebSocket endpoint for streaming transcription.Request:
{
"audio": {
"data": "<base64-encoded-audio>",
"encoding": "audio/wav",
"sample_rate": "16000"
}
}
Response (events + data):
{"type": "events", "data": {"signal_type": "START_SPEECH", "occured_at": 1234567890.0, "session_id": "..."}}
{"type": "events", "data": {"signal_type": "END_SPEECH", "occured_at": 1234567890.0, "session_id": "..."}}
{
"type": "data",
"data": {
"request_id": "...",
"transcript": "transcribed text",
"language_code": "hi-IN",
"metrics": {
"audio_duration": 3.5,
"processing_latency": 0.42
}
}
}
Training is executed via the provided shell script:
bash run_training.sh
This script:
requirements.txt.train_file.py with GPU support (CUDA_VISIBLE_DEVICES=0)../whisper-indic-voice-agent-small.Users should validate transcription quality on their target language and domain before deploying in production. Consider using a larger base model (e.g., whisper-small or whisper-medium) for improved accuracy.
CUDA_VISIBLE_DEVICES=0). We used 1x L4 GPU to train this over 3 GPU hours.