#268·kokoro

A qery about Style vector extraction & .pt tensor (which we are loading from huggingface During inference. ) for Research & Improvement purpose

Author: 1PD-IS-NO-1Created Sep 22, 2025Updated Aug 10, 2026

Dear Developer Team of KOKORO,

Question: Style Vector (ref_s) Creation and Usage in Kokoro

Confusion Point

I'm trying to understand how style vectors (ref_s) work in Kokoro, specifically:

  1. During Training: Are style vectors computed for each audio-text pair, or only once per speaker?
  2. During Inference: How can a single pre-computed style vector work for any arbitrary text?
  3. Hugging Face Storage: What exactly is stored in the .pt files for each voice?

My Current Understanding

I understand that:

  • ref_s represents speaker voice characteristics
  • During inference, we load a pre-computed vector (e.g., af_bella.pt)
  • This same vector is used for all text inputs for that voice

What's Unclear

  1. If during training, each audio file has its own ref_s, how does inference work with just one vector?
  2. How is the model able to generate appropriate prosody for different texts using the same style vector?
  3. What was the exact process used to create the style vectors available on Hugging Face?

Hypothesis

I suspect that:

  • Style vectors are computed per speaker (not per audio file) before training
  • The vectors on Hugging Face are averaged representations from multiple utterances of the same speaker
  • The model learns to use the style vector as a "voice conditioner" independent of text content

Could you clarify the exact methodology for style vector creation and how the training process incorporates them?