﻿# Kokoro voice packs: phoneme length selects conditioning within the pack

Preserve Kokoro language-aware chunking and length-indexed voice-pack selection when exporting a model or building an inference wrapper around its low-level interface.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-kokoro-length-indexed-voice-pack/
Language: en

## Distinguish the model from its support pipeline

The [Kokoro release card](https://huggingface.co/hexgrad/Kokoro-82M) pairs a speech model with voice assets and a language-aware pipeline. Exporting only the acoustic model does not automatically export every decision made by that support code. A low-level wrapper must reproduce the intended preparation and conditioning inputs. Successful execution of an exported graph is therefore only part of demonstrating equivalence to the original text-to-audio route.

## Inspect the voice-pack lookup

The [official pipeline source](https://raw.githubusercontent.com/hexgrad/kokoro/main/kokoro/pipeline.py) selects a voice-pack entry using the effective phoneme-sequence length before calling the model. The pack is consequently not just a single fixed vector with a decorative outer dimension. Retaining only one arbitrary entry changes the reference behavior. Preserve the selected index and the phoneme sequence that determines it when debugging an export, rather than guessing that the first available row represents the entire voice.

## Keep chunking connected to conditioning

The same implementation performs language-specific text-to-phoneme preparation and chunking. A chunk boundary changes the effective phoneme string passed to a call, which can also change the selected voice-pack entry. The [official repository](https://github.com/hexgrad/kokoro) supplies the corresponding usage path. Do not compute a conditioning row from the original document's character count and reuse it for every chunk; written length and prepared phoneme length are different quantities, and each low-level call has its own effective input.

## Diagnose an exported-wrapper discrepancy

Consider a short sentence that matches the reference but a longer paragraph that sounds different after export. Compare prepared chunks, phoneme strings, and selected pack entries before assuming a numerical precision problem. Use the same voice asset and sampling configuration. If the wrappers select different conditioning, their outputs need not match even when the acoustic graph is unchanged. This is a structural diagnostic, not an assertion that every long-text difference is caused by voice-pack lookup.

## Save the full low-level request

Record model and pipeline revisions, language front end, original chunk text, effective phonemes, voice asset, selected conditioning entry, and speed settings. Guides to [tensor axes](/journal/tensor-axes-batch-sequence-hidden/) and [artifact validation](/journal/safetensors-artifact-validation/) support the comparison. Test multiple effective lengths and language routes before claiming export equivalence. The meaningful contract includes the lookup connecting prepared language input to voice conditioning, rather than merely the acoustic weights and an arbitrarily flattened voice tensor.
