Automatic Speech Recognition
ONNX
GGUF
Hindi
English
llama.cpp
audio
speech-recognition
conversational
Instructions to use ashirbadsahu/shrutam-2-onnx-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ashirbadsahu/shrutam-2-onnx-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ashirbadsahu/shrutam-2-onnx-gguf:F16 # Run inference directly in the terminal: llama cli -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ashirbadsahu/shrutam-2-onnx-gguf:F16 # Run inference directly in the terminal: llama cli -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ashirbadsahu/shrutam-2-onnx-gguf:F16 # Run inference directly in the terminal: ./llama-cli -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ashirbadsahu/shrutam-2-onnx-gguf:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Use Docker
docker model run hf.co/ashirbadsahu/shrutam-2-onnx-gguf:F16
- LM Studio
- Jan
- Ollama
How to use ashirbadsahu/shrutam-2-onnx-gguf with Ollama:
ollama run hf.co/ashirbadsahu/shrutam-2-onnx-gguf:F16
- Unsloth Desktop
- Pi
How to use ashirbadsahu/shrutam-2-onnx-gguf with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "ashirbadsahu/shrutam-2-onnx-gguf:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use ashirbadsahu/shrutam-2-onnx-gguf with Docker Model Runner:
docker model run hf.co/ashirbadsahu/shrutam-2-onnx-gguf:F16
- Lemonade
How to use ashirbadsahu/shrutam-2-onnx-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ashirbadsahu/shrutam-2-onnx-gguf:F16
Run and chat with the model
lemonade run user.shrutam-2-onnx-gguf-F16
List all available models
lemonade list
- Hermes Agent
How to use ashirbadsahu/shrutam-2-onnx-gguf with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default ashirbadsahu/shrutam-2-onnx-gguf:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use ashirbadsahu/shrutam-2-onnx-gguf with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ashirbadsahu/shrutam-2-onnx-gguf:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "ashirbadsahu/shrutam-2-onnx-gguf:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Shrutam-2 ONNX & GGUF Inference Guide
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 withllama.cpp.
Model Architecture Overview
- Input Audio: 16 kHz Mono Audio Waveform
[batch_size, num_samples] - Audio Encoder (
shrutam_encoder.onnx):- MelSpectrogram Preprocessor (Log-Mel extraction)
- Conformer Encoder (1024 d_model)
- 1D Convolution Downsampler
- SMEAR MoE Router and Expert Projector
- Output: Projected embeddings
[batch_size, feature_length, 2048]
- LLM Decoder (
shrutam_llm_*.gguf):- LlamaForCausalLM (2048 hidden size, 16 layers, 128k vocabulary)
Requirements
pip install onnxruntime torchaudio torch llama-cpp-python
Python Usage Example
Step 1: Run the Audio Encoder (ONNX)
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)
Step 2: Pass Audio Embeddings into GGUF LLM (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))
File Details
| 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 |
Technical Features
- Dynamic Audio Length Support: Accepts variable length 16kHz audio inputs dynamically.
- Hardware Agnostic: Runs seamlessly on CPU (
CPUExecutionProvider) or GPU (CUDAExecutionProvider). - No PyTorch dependency required for inference: Pure ONNX Runtime + C++ / GGUF runner integration.
- Downloads last month
- 227
Hardware compatibility
Log In to add your hardware
4-bit
16-bit
Model tree for ashirbadsahu/shrutam-2-onnx-gguf
Base model
bharatgenai/Shrutam-2