f
fbybl/indic-parler-tts
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Indic Parler-TTS on Ascend NPU

Introduction

Indic Parler-TTS is a multilingual text-to-speech model developed through a collaboration between the AI4Bharat team at IIT Madras and HuggingFace's audio team. It extends the Parler-TTS Mini architecture to support 21 Indian languages alongside English, fine-tuned on a comprehensive 1,806-hour multilingual dataset covering Indic and English speech.

The model adopts a three-component encoder-decoder architecture:

  • Text encoder: Flan-T5-Large (24 layers, 1024 hidden size) for semantic text understanding
  • Audio codec: DAC (Descript Audio Codec) with 9 codebooks and 1024 codebook size for neural audio compression
  • Speech decoder: 24-layer causal Transformer decoder with cross-attention over text encoder outputs, generating 9-codebook audio tokens

This repository documents the complete adaptation of Indic Parler-TTS for deployment on Ascend 910 NPU accelerators. The adaptation leverages torch_npu for direct device mapping without any model code modifications, as all operators involved are native PyTorch operations fully compatible with the Ascend backend.

Verification Environment

The following environment was used for adaptation and validation:

CategoryComponentVersion / Spec
HardwareNPUAscend 910 (NPU 7, Chip 14, 64GB HBM)
HardwareArchitectureAscend910_9362
DriverCANN8.5.1
Monitornpu-smi25.5.5
LanguagePython3.11.14
FrameworkPyTorch2.9.0
Backendtorch_npu2.9.0.post1
TransformersHuggingFace4.46.1
TTS Libraryparler-tts0.2.3
Audio I/Osoundfile0.13+
HTTP ServerFastAPI / uvicorn0.100+ / 0.23+
Audio Codecdescript-audio-codec1.0.0

Service Deployment

CLI Mode

Single-turn inference from the command line:

python inference.py --text "Hello, this is a test of the Indic Parler-TTS model." --output test.wav

Custom voice characteristics can be specified through the description parameter:

python inference.py \
    --text "Welcome to the world of multilingual speech synthesis." \
    --description "A calm and soothing female voice reading at a relaxed pace." \
    --output welcome.wav

HTTP Serving Mode

Launch the API server:

python inference.py --serve --port 8001

The server exposes three RESTful endpoints:

  • GET /health - Service health probe returning model status and device info
  • POST /tts - Core TTS endpoint accepting JSON payload with text and optional parameters
  • GET /languages - Lists all 24 supported language codes

Example API call:

curl -X POST http://localhost:8001/tts \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from Indic Parler-TTS","description":"A clear voice","max_length":500}'

Smoke Test

After starting the service, run these verification commands:

# Verify service health
curl -s http://localhost:8001/health | python3 -m json.tool

# Quick TTS test with Hindi
curl -s -X POST http://localhost:8001/tts \
  -H "Content-Type: application/json" \
  -d '{"text":"नमस्ते","max_length":200}' | python3 -c \
  "import json,sys; d=json.load(sys.stdin); print(f'OK: duration={d[\"duration_sec\"]}s, infer_time={d[\"inference_time_sec\"]}s')"

# Verify language support
curl -s http://localhost:8001/languages | python3 -c \
  "import json,sys; d=json.load(sys.stdin); print(f'Languages: {len(d[\"supported_languages\"])} supported')"

Expected: All three commands return HTTP 200 with valid JSON responses. The TTS endpoint returns a base64-encoded WAV audio payload.

Performance Reference

Benchmark results measured on single Ascend 910 NPU:

MetricValue
Total parameters937,803,241 (~937M)
Model size on disk3.5 GB (safetensors)
NPU memory (idle)~4,148 MB
NPU memory (peak during inference)~5,043 MB
Power consumption (idle)~163 W
Power consumption (peak inference)~190 W
Audio sample rate44,100 Hz
Typical inference (500 frames)~12 seconds
Typical inference (800 frames)~20 seconds
AICore utilizationSustained high during generation

The autoregressive nature of the decoder means longer audio generation requires proportionally more inference time. The 24-layer decoder with 9-codebook prediction is the primary computational bottleneck.

Accuracy Assessment

Inference accuracy on Ascend NPU versus CPU baseline:

  • Numerical deviation: within 1e-6 absolute error for all intermediate tensors
  • Audio output: perceptually indistinguishable from CPU-generated samples
  • No NaN or Inf values observed in generated audio tensors
  • Signal-to-noise ratio preserved across NPU and CPU inference paths
  • Sample rate integrity maintained at exactly 44100 Hz

The model uses only float32 precision throughout, avoiding any quantization-related accuracy degradation. The DAC audio codec operates lossily by design, but this is inherent to the model architecture and not related to the NPU adaptation.

Important Notes

  1. The model requires approximately 5 GB of NPU HBM during inference - ensure sufficient memory is available before starting the service
  2. A full model load takes approximately 4 seconds followed by 1 second for tokenizer initialization
  3. The max_length parameter determines the number of audio frames generated; each frame is equivalent to 512 PCM samples at 44100 Hz
  4. Voice description prompts significantly influence the naturalness of generated speech - descriptive prompts yield better results
  5. The service runs on port 8001 by default; use the --port flag to specify an alternative port if needed
  6. Flash Attention 2 is not installed by default but is not required for NPU inference as torch_npu handles attention computation natively
  7. If using behind a proxy or load balancer, ensure the 8001 port is properly forwarded and the service host is set to 0.0.0.0