--- license: apache-2.0 language: - en - hi - bn - gu - kn - ml - mr - or - pa - ta - te tags: - audio - speech - audio-codec - speech-tokenizer - speech-language-models - onnx pipeline_tag: audio-to-audio base_model: prakharkhatri/IndiCodec datasets: - amphion/Emilia-Dataset - mythicinfinity/libritts - mythicinfinity/libritts_r - CSTR-Edinburgh/vctk - ai4bharat/Rasa - ai4bharat/indicvoices_r - ai4bharat/IndicVoices --- # IndiCodec-Lite A distilled, lightweight version of [IndiCodec](https://huggingface.co/prakharkhatri/IndiCodec): the same 1.09 kbps speech codec and the same tokens in **58 M parameters (75 MB in INT8)**, small enough for CPUs and phones. ## Key features - **Same tokens as IndiCodec v1.0.** Content stream (25 Hz) + acoustic stream (50 Hz), the same FSQ grids. A speech LM or TTS trained on IndiCodec tokens decodes with IndiCodec-Lite, and the other way round. - **11x smaller:** 58 M parameters vs 624 M. 75 MB as INT8 ONNX, 232 MB in fp32. - **Runs without a GPU:** PyTorch on GPU or CPU, or ONNX Runtime (numpy + onnxruntime, no PyTorch). On ARM (phones, Apple silicon) the INT8 files run at 0.064 x real time on 4 CPU threads. - **Keeps IndiCodec's lead on words:** more words kept than Mimi, SNAC and NeuCodec at about 1 kbps, in English and in Indian languages (ahead of SNAC and NeuCodec in each of the 10 languages tested). - **16 kHz in, 24 kHz out.** Any input sample rate is resampled. - **Commercial use allowed:** Apache 2.0. ## Model details | | | |---|---| | Content stream | 25 Hz, FSQ 8 × 3 levels = 6,561 ids, 317 bps | | Acoustic stream | 50 Hz, FSQ 6 × 6 levels = 46,656 ids, 775 bps | | Bitrate | 1.09 kbps | | Parameters | 58 M: content encoder 21.8 M, acoustic encoder 14.8 M, decoder 21.2 M | | Files | `model.safetensors` (fp32, PyTorch); `onnx/` INT8 set (75 MB) and fp32 set (233 MB) | | Licence | Apache 2.0 | All three networks were distilled from IndiCodec v1.0 against its frozen quantizers: the content encoder (a 6 x 384 Conformer initialised from w2v-BERT 2.0) to reproduce its content ids, with noise added to the input; the acoustic encoder (a CNN) to reproduce its acoustic features; and the decoder (8 x 384 transformer, ISTFT head) to reproduce its audio from the same ids. ## Quality Speech codecs at about 1 kbps, on speakers not seen in training. Every codec is scored on the same clips with the same scorers as the [IndiCodec card](https://huggingface.co/prakharkhatri/IndiCodec). PESQ-WB (higher is better): | Test set | IndiCodec-Lite
1.09 kbps | IndiCodec v1.0
1.09 kbps | Mimi, 8 codebooks
1.10 kbps | SNAC 24 kHz
0.98 kbps | NeuCodec
0.80 kbps | |---|---|---|---|---|---| | LibriTTS-R test (English) | 2.35 | **2.41** | 2.32 | 2.29 | 2.19 | | CMU-Arctic (English) | 2.27 | **2.30** | 2.28 | 2.17 | 2.06 | | Seed-TTS eval (English) | 1.97 | 1.99 | **2.07** | 1.82 | 1.81 | | FLEURS, 10 Indian languages | 1.87 | **1.90** | 1.84 | 1.69 | 1.69 | Intelligibility and voice (higher is better): | | IndiCodec-Lite | IndiCodec v1.0 | Mimi | SNAC | NeuCodec | |---|---|---|---|---|---| | ESTOI, CMU-Arctic (English) | 0.850 | **0.855** | 0.848 | 0.835 | 0.824 | | ESTOI, Seed-TTS eval (English) | 0.782 | 0.786 | **0.794** | 0.762 | 0.758 | | ESTOI, FLEURS, 10 Indian languages | **0.640** | **0.640** | 0.613 | 0.595 | 0.591 | | Speaker similarity, Seed-TTS eval (English) | 0.961 | **0.964** | **0.964** | 0.946 | 0.957 | Words after a round trip (lower is better): | | IndiCodec-Lite | IndiCodec v1.0 | Mimi | SNAC | NeuCodec | |---|---|---|---|---|---| | English WER, Seed-TTS eval | 3.1 % | **2.5 %** | 3.6 % | 4.9 % | 3.5 % | | English WER, CMU-Arctic | 2.4 % | **2.3 %** | 3.2 % | 3.8 % | 2.8 % | | Indian-language CER, FLEURS, 10 languages | 6.9 % | **6.3 %** | 14.3 % | 13.3 % | 8.9 % | | Tokens per second | 75 | 75 | 100 | 82 | 50 | English WER uses Whisper large-v3; Indian-language CER uses the IndicConformer 600M ASR. Speaker similarity is the cosine between WavLM-base-plus-sv x-vectors of each decode and its own original. IndiCodec-Lite rows are the fp32 weights; the INT8 files on ARM score within 0.004 PESQ of them. ## Use PyTorch (GPU or CPU), same environment as IndiCodec: ```bash hf download prakharkhatri/IndiCodec-Lite --local-dir IndiCodec-Lite && cd IndiCodec-Lite pip install torch==2.6.0 torchaudio==2.6.0 safetensors soundfile scipy transformers==4.51.* vector-quantize-pytorch==1.17.8 torchtune==0.5.0 torchao==0.9.0 local-attention einops librosa pip install --no-deps "git+https://github.com/neuphonic/neucodec@ed3e6cd" ``` ```python import soundfile as sf from indicodec_lite import IndiCodecLite codec = IndiCodecLite.load("model.safetensors") wav, sr = sf.read("speech.wav") content, acoustic = codec.encode(wav, sr) # token arrays audio = codec.decode(content, acoustic) # 24 kHz ``` ONNX Runtime (CPUs and phones, no PyTorch): ```bash pip install numpy scipy soundfile safetensors "onnxruntime>=1.18" ``` ```python from indicodec_lite import IndiCodecLiteONNX codec = IndiCodecLiteONNX.load(".") # precision="auto": INT8 on ARM, fp32 on x86 content, acoustic = codec.encode(wav, sr) audio = codec.decode(content, acoustic) ``` On x86 CPUs, `auto` picks the fp32 files: onnxruntime's INT8 kernels can saturate on x86 CPUs without VNNI and change the ids. On GPUs, use the PyTorch weights, or `onnxruntime-gpu` with `providers=["CUDAExecutionProvider"]` and `precision="fp32"`. The Lite encoders write the same token space as IndiCodec v1.0 but not identical ids (about a third of the frames match exactly; the rest are neighbouring values). Ids from either codec decode with the other; for training a model, encode the whole corpus with one of them. ## Training data English: Emilia-YODAS (English part only), LibriTTS, LibriTTS-R and VCTK. Indian languages: Rasa, IndicVoices-R and IndicVoices from AI4Bharat. Noise for augmentation: MUSAN and RIRS_NOISES. All CC BY 4.0, except RIRS_NOISES (Apache 2.0). No audio is included in this release. ## Limits - Speech only; not for music. - Not streaming: the encoders and the decoder attend over the whole clip. - Words: about +0.6 points English WER and +0.5 points Indian-language CER over IndiCodec v1.0 (tables above). ## Licence Apache 2.0. Distilled from IndiCodec v1.0 (Apache 2.0), which is built on [NeuCodec](https://huggingface.co/neuphonic/neucodec) (Apache 2.0); the decoder classes load from `neucodec`. The content encoder was initialised from [w2v-BERT 2.0](https://huggingface.co/facebook/w2v-bert-2.0) (MIT; licence text in `indicodec_lite/w2v_bert/LICENSE`).