README_EXPLAINER
Purpose: give strong project context to humans and Copilot agents running on a RunPod pod.
Project summary
This project hosts an Indic multilingual TTS model behind an HTTP API, with a small input surface for end users:
- utterance
- language
- user_id
The service applies tuned inference defaults server-side and returns generated audio.
Source model and pipeline context
Base model details:
- Model lineage is based on
snorbyte/snorTTS-Indic-v0 - Hosted checkpoint currently used by this project:
Mevearth2/Quantized-Merged-TTS - Architecture family: LLaMA-style causal LM generating audio tokens
- Audio decode backend: SNAC (
hubertsiuzdak/snac_24khz)
High-level generation flow:
- Build prompt with language + speaker id + utterance
- Generate SNAC token ids with the LM
- Convert token stream into SNAC codebooks
- Decode to 24 kHz waveform
- Apply optional post-process (speed, denoise)
Prompt format used:
<custom_token_3><|begin_of_text|>{language}{user_id}: {utterance}<|eot_id|><custom_token_4><custom_token_5><custom_token_1>
Data context (important for future finetuning)
Training dataset reference:
- HF dataset:
snorbyte/indic-tts-sample-snac-encoded
Observed splits:
stage_1stage_2eval
Common columns in all splits:
- utterance
- language
- emotion
- type
- act
- rating
- gender
- age
- environment
- user
- snac_codes
- stage
Language set:
- hindi
- tamil
- telugu
- marathi
- kannada
- malayalam
- punjabi
- gujarati
- bengali
Note for retraining work:
- The hosted dataset split names are not
train/valid/test; scripts should usestage_1,stage_2,evalexplicitly.
Speaker mapping context
This project includes language-speaker validation and recommended speed defaults in app/speaker_map.py.
Current practical mapping by language:
- hindi: 159, 49, 43
- tamil: 188, 128, 176
- bengali: 125
- malayalam: 189, 124
- kannada: 142, 138, 131, 59
- telugu: 69, 133
- punjabi: 191, 67, 201
- gujarati: 62, 190
- marathi: 205, 82, 199, 203
What has already been implemented
Production starter API:
app/main.pyPOST /v1/tts(inputs: utterance, language, user_id)GET /v1/options(dropdown data for UI)GET /healthGET /ready
Inference runtime:
app/runtime.py- one-time model load
- runtime defaults for generation
- prompt construction
- token-to-audio decode
- wav bytes response
Schemas:
app/schemas.py
Speaker map and validation:
app/speaker_map.py
Load test starter:
loadtest/locustfile.pyloadtest/requirements.txt
RunPod no-docker scripts:
scripts/runpod_setup.shscripts/runpod_start.sh
Important environment variables
Main:
MODEL_NAME(defaultMevearth2/Quantized-Merged-TTS)HF_TOKEN
Service behavior:
MAX_INFLIGHT_REQUESTSTTS_TEMPERATURETTS_TOP_PTTS_REPETITION_PENALTYTTS_MAX_SEQ_LENGTHTTS_MAX_WORDSTTS_DENOISE
Template file:
.env.example(no secrets) Actual runtime secrets:.env(do not commit)
Why no-docker path exists
Docker image builds were unstable due to slow network/timeouts while downloading large Python wheels in some environments.
Current recommended fast path:
- Open RunPod PyTorch pod
- Clone
tts_hostinginto/workspace/tts_hosting - Run
scripts/runpod_setup.sh - Run
scripts/runpod_start.sh
Current known constraints
- Generation can be slow for long utterances, so word limits are enforced.
- Denoise dependencies are intentionally optional to reduce deployment friction.
- 5090 GPUs require newer PyTorch builds; verify pod torch compatibility first.
What to do next (execution plan)
Phase 1: Stabilize endpoint
- Deploy via no-docker RunPod path
- Verify
/readyand sample/v1/ttscalls - Confirm language-user validation behavior
Phase 2: Frontend readiness
- Use
/v1/optionsfor language and speaker dropdowns - Keep only 3 user inputs in UI
- Keep generation knobs hidden on backend defaults
Phase 3: Load testing
- Run Locust against pod URL
- Sweep concurrency: 1, 2, 4, 8, 12
- Track p50/p95/p99 latency and error rate
- Set stable
MAX_INFLIGHT_REQUESTS
Phase 4: Production hardening
- Add API authentication
- Add structured logs and metrics
- Add queue/backpressure policy and request timeout policy
- Add autoscaling strategy and cost-per-request reporting
For Copilot agents on pod
When helping on this repo, prioritize:
- Reliability over feature creep
- Keeping API input surface simple
- Preserving speaker/language validation
- Avoiding dependency bloat unless requested
- Not committing secrets from
.env
If modifying runtime behavior, always keep:
- prompt format compatibility
- speaker mapping checks
- deterministic server defaults unless explicitly changed