Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringclasses
10 values
locust==2.37.2
fastapi==0.115.12
uvicorn[standard]==0.34.2
pydantic==2.11.3
numpy==1.26.4
soundfile==0.13.1
loguru==0.7.3
huggingface_hub==0.31.1
transformers==4.51.3
snac==1.2.1

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

snorTTS Hosting Pipeline (RunPod + Load Testing)

This folder contains a complete starter pipeline for hosting your TTS model with a simple API and testing parallel load.

1) What users get

  • A single HTTP endpoint: POST /v1/tts
  • Inputs: utterance, language, user_id
  • Defaults are server-side tuned.
  • Optional options endpoint for dropdowns: GET /v1/options

2) API Contract

POST /v1/tts

Request body:

{
  "utterance": "नमस्ते, आप कैसे हैं?",
  "language": "hindi",
  "user_id": "159"
}

Response modes:

  • response_mode=wav (default): returns audio/wav
  • response_mode=json: returns base64 audio and metadata

Example:

curl -X POST "http://localhost:8000/v1/tts?response_mode=wav" \
  -H "Content-Type: application/json" \
  -d '{"utterance":"नमस्ते, आप कैसे हैं?","language":"hindi","user_id":"159"}' \
  --output out.wav

GET /v1/options

Returns dropdown-compatible language/speaker map and defaults.

GET /health

Simple liveness check.

GET /ready

True once model and decoder are loaded.

3) Local run (before RunPod)

  1. Copy env:
cp .env.example .env
  1. Set HF_TOKEN in .env.

  2. Build image:

docker build -t snortts-api:latest .
  1. Run container:
docker run --gpus all --env-file .env -p 8000:8000 snortts-api:latest

Optional (only if you want denoise enabled in production image):

# Add these to requirements and rebuild only if needed
pip install librosa==0.11.0 deepfilternet==0.5.6
  1. Smoke test:
curl http://localhost:8000/ready

4) RunPod deployment steps

  1. Push image to Docker Hub or GHCR.
  2. Create RunPod GPU Pod.
  3. Set container image to your pushed tag.
  4. Expose port 8000.
  5. Add env vars from .env.example in RunPod UI.
  6. Wait for startup, then test /ready.
  7. Test /v1/tts.

4B) RunPod without Docker (recommended if image build is flaky)

You can deploy directly on a standard RunPod PyTorch pod without building an image.

  1. Create a GPU Pod from a PyTorch template (CUDA 12.1 compatible).
  2. Expose port 8000.
  3. In Pod terminal, clone or upload this tts_hosting folder under /workspace/tts_hosting.
  4. Create .env (copy from .env.example) and set at least HF_TOKEN.
  5. Run setup once:
cd /workspace/tts_hosting
bash scripts/runpod_setup.sh

Note: setup installs torch and torchaudio from the CUDA 12.8 index for better compatibility with newer GPUs (including RTX 5090-class pods).

  1. Start API server:
cd /workspace/tts_hosting
bash scripts/runpod_start.sh
  1. Check readiness from your local machine:
curl http://<runpod-public-ip-or-url>:8000/ready
  1. Test generation:
curl -X POST "http://<runpod-public-ip-or-url>:8000/v1/tts?response_mode=wav" \
  -H "Content-Type: application/json" \
  -d '{"utterance":"नमस्ते, आप कैसे हैं?","language":"hindi","user_id":"159"}' \
  --output out.wav

Tip: if the pod restarts often, keep code and venv under /workspace so it persists.

5) Load testing with Locust

From this directory:

pip install -r loadtest/requirements.txt

Then run:

locust -f loadtest/locustfile.py --host http://<your-runpod-url>

Or headless:

locust -f loadtest/locustfile.py --host http://<your-runpod-url> \
  --users 10 --spawn-rate 2 --run-time 5m --headless

6) Suggested test plan

  • Step 1: users 1, 2, 4, 8, 12
  • Step 2: record p50, p95, p99 latency
  • Step 3: record failure rate and GPU memory usage
  • Step 4: choose safe MAX_INFLIGHT_REQUESTS

7) Key files

  • app/main.py: FastAPI endpoints
  • app/runtime.py: model load and synthesis runtime
  • app/speaker_map.py: language -> speaker IDs + default speed
  • loadtest/locustfile.py: parallel load test script
  • Dockerfile: deployable image for RunPod

8) Persistence checklist (before stopping pod)

Use this quick checklist before stopping or recreating your pod:

  1. Confirm critical artifacts are pushed to Hugging Face:
  • model repos
  • adapter checkpoints
  • sample audio datasets (if needed)
  1. Confirm runtime config is saved in project files:
  • .env
  • app/speaker_map.py
  1. Keep project under /workspace/tts_hosting (network volume).
  2. Do not rely on root filesystem paths outside /workspace for anything critical.

What usually persists:

  • /workspace/*
  • remote artifacts (Hugging Face, Git)

What may not persist across image/pod recreation:

  • global apt installs
  • global pip installs
  • temporary files under root filesystem

9) Fast recovery setup (if some data is lost)

If your environment is partially reset but /workspace/tts_hosting still exists:

  1. Reinstall runtime deps and venv:
cd /workspace/tts_hosting
bash scripts/runpod_setup.sh
  1. Restore .env values (especially HF_TOKEN and MODEL_NAME).

  2. Start service:

cd /workspace/tts_hosting
bash scripts/runpod_start.sh
  1. Verify locally:
curl http://127.0.0.1:8000/health
curl http://127.0.0.1:8000/ready
curl http://127.0.0.1:8000/v1/options
  1. Verify public URL (if HTTP port 8000 is exposed):
curl https://<pod-id>-8000.proxy.runpod.net/health
  1. Smoke-test synthesis:
curl -X POST "http://127.0.0.1:8000/v1/tts?response_mode=wav" \
  -H "Content-Type: application/json" \
  -d '{"utterance":"नमस्ते, आप कैसे हैं?","language":"hindi","user_id":"159"}' \
  --output out.wav

10) Optional backup command

Create a lightweight backup archive (without virtualenv and cache):

cd /workspace
tar --exclude='.git' --exclude='.venv-tts' --exclude='__pycache__' \
   -czf tts_hosting_backup_$(date +%F_%H%M).tar.gz tts_hosting
Downloads last month
16