Downloads · 30 days
42
14% of all-time downloads
ashirbadsahu/shrutam-2-onnx-gguf
shrutam-2-onnx-gguf is a automatic speech recognition model from ashirbadsahu. Use it when you need speech turned into text. It is set up for llama.cpp. The card lists the license as apache-2.0.
This repository provides optimized formats for Shrutam-2: 1. shrutamencoder.onnx: Standalone speech encoder combining Log-Mel Spectrogram preprocessing, 17-layer Conformer Encoder, Conv1D Downsampler, and SMEAR MoE Pr…
Downloads · 30 days
42
14% of all-time downloads
All-time downloads
300
Public
Repo size
3.3 GB
Likes
0
Public
Click a slice to open those files.
.gguf3.3 GB · 100%
From the Hugging Face model README
This repository provides optimized formats for Shrutam-2:
shrutam_encoder.onnx: Standalone speech encoder combining Log-Mel Spectrogram preprocessing, 17-layer Conformer Encoder, Conv1D Downsampler, and SMEAR MoE Projector into a single ONNX computational graph.shrutam_llm_f16.gguf / shrutam_llm_q4_k_m.gguf: GGUF quantized models for the LLM component, compatible with llama.cpp.[batch_size, num_samples]shrutam_encoder.onnx):
[batch_size, feature_length, 2048]shrutam_llm_*.gguf):
pip install onnxruntime torchaudio torch llama-cpp-python
import torch
import torchaudio
import onnxruntime as ort
# 1. Configure ONNX Runtime Session
opts = ort.SessionOptions()
opts.intra_op_num_threads = 4
opts.log_severity_level = 3 # Suppress internal warnings
session = ort.InferenceSession("shrutam_encoder.onnx", sess_options=opts, providers=["CPUExecutionProvider"])
# 2. Load 16kHz Audio Waveform
wav, sr = torchaudio.load("audio.wav")
if sr != 16000:
resampler = torchaudio.transforms.Resample(orig_freq=sr, new_freq=16000)
wav = resampler(wav)
if wav.dim() == 1:
wav = wav.unsqueeze(0)
elif wav.shape[0] > 1:
wav = wav.mean(dim=0, keepdim=True)
# 3. Extract Audio Embeddings via ONNX
audio_embeds = session.run(None, {"audio": wav.numpy()})[0]
print("Audio Embeddings Shape:", audio_embeds.shape) # Shape: (1, seq_len, 2048)
llama.cpp)from llama_cpp import Llama
import numpy as np
# Load GGUF LLM Model
llm = Llama(
model_path="shrutam_llm_q4_k_m.gguf",
n_ctx=4096,
n_threads=4,
verbose=False
)
# Prefix prompt formatting for Shrutam-2
prompt_text = "<|im_start|>user\nTranscribe speech to Hindi text.<|im_end|>\n<|im_start|>assistant\n"
prompt_tokens = llm.tokenize(prompt_text.encode("utf-8"), add_bos=True)
# Note: Combine audio_embeds with text prompt token embeddings using llama.cpp input embedding API.
print("Prompt Tokens Count:", len(prompt_tokens))
| Filename | Format | Description | Size |
|---|---|---|---|
shrutam_encoder.onnx | ONNX (opset 17) | Unified Conformer Encoder + SMEAR MoE Projector | ~3.05 MB |
shrutam_llm_f16.gguf | GGUF (FP16) | Unquantized LLM Decoder | ~2.4 GB |
shrutam_llm_q4_k_m.gguf | GGUF (Q4_K_M) | 4-bit Quantized LLM Decoder | ~803 MB |
CPUExecutionProvider) or GPU (CUDAExecutionProvider).