ai4bharat/IndicVoices
Viewer • Updated • 6.38M • 13.6k • 74
How to use theharshithh/open-sarika with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("automatic-speech-recognition", model="theharshithh/open-sarika") # Load model directly
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
processor = AutoProcessor.from_pretrained("theharshithh/open-sarika")
model = AutoModelForSpeechSeq2Seq.from_pretrained("theharshithh/open-sarika")This is a speech recognition and translation model for Indian languages (Hindi, Gujarati, and Marathi). The model can transcribe speech in these languages and translate between them. This is an open-source implementation inspired by Sarvam AI's Sarika model.
The model can be used for:
Here's a simple example to get started:
from transformers import WhisperProcessor, WhisperForConditionalGeneration
import torch
import librosa
model_id = "theharshithh/open-sarika-v1"
device = "cuda" if torch.cuda.is_available() else "cpu"
# Load model and processor
processor = WhisperProcessor.from_pretrained(model_id)
model = WhisperForConditionalGeneration.from_pretrained(model_id).to(device)
model.config.forced_decoder_ids = None
# Load and process audio
audio_path = "your_audio.wav"
audio, rate = librosa.load(audio_path, sr=16000)
# Generate transcription
inputs = processor(audio, sampling_rate=16000, return_tensors="pt").to(device)
with torch.no_grad():
output_ids = model.generate(**inputs)
transcription = processor.batch_decode(output_ids, skip_special_tokens=True)[0]
The model was trained on a variety of datasets, including:
For issues and feedback, please create an issue on the model's repository: https://huggingface.co/theharshithh/open-sarika-v1
Github Repo: https://github.com/theharshithh/open-sarika
Base model
openai/whisper-large-v3