Skip to content

irodori_tts: load checkpoints without a duration predictor - #832

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
KKTTSPJ:pr/irodori-no-duration-predictor
Oct 8, 2026
Merged

0xShug0 merged 1 commit into
0xShug0:mainfrom
KKTTSPJ:pr/irodori-no-duration-predictor

Conversation

@KKTTSPJ

@KKTTSPJ KKTTSPJ commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Irodori-TTS checkpoints before the duration predictor existed — the original 500M v2 release, and models fine-tuned from it — carry no duration_predictor.* weights, and their config has no use_duration_predictor key. The Python runtime handles them: ModelConfig.use_duration_predictor defaults to False, and without an explicit duration InferenceRuntime.synthesize generates 30 seconds and lets trim_tail cut the trailing silence.

audio.cpp defaults the flag to true, so such a checkpoint fails to load:

audiocpp_cli failed: missing tensor: duration_predictor.token_input_proj.weight

This makes irodori_tts follow the Python runtime. Model-local; no framework, server or CLI change.

Changes

  • IrodoriModelConfig::use_duration_predictor defaults to false, as in Python. Every published irodori_tts package sets it to true explicitly (checked: the v3 500M, v3 600M VoiceDesign, v4 Small, v4.1 Small and v4.1 Anime GGUFs, q8_0 and f16), so they are unaffected.
  • When it is false, the condition encoder neither loads the duration_predictor.* weights nor builds the duration graph. Its speaker and caption flag inputs feed only that graph, so they are not created either: left in the graph unread, gallocr would give them no storage and writing them would fail.
  • Weight validation asks for the caption-side duration tensors (duration_predictor.null_caption, caption_modulation) only when there is a duration predictor.
  • resolve_sample_shape: with no duration_sec and no predictor, 30 s (ceil(30 * sample_rate / hop) latent steps, as in Python). trim_tail then trims as usual. duration_sec works as before; duration_scale has nothing to scale.
  • Docs: a short note in docs/models/irodori_tts.md.

Validation

Windows 10, MSVC 14.51, CUDA 12.8, RTX 5060 Ti (sm_120). Built with -DAUDIOCPP_MODEL_SET=custom -DAUDIOCPP_MODELS=irodori_tts, CPU (AVX2) and CUDA. (The local CUDA build also needed a workaround for MSVC 14.51 being newer than CUDA 12.8 supports; it is not part of this PR.) Each configuration ran in one long-lived audiocpp_server; seed 42.

Checkpoint without a duration predictor: Aratako/Irodori-TTS-500M-v2 (model.safetensors, model_config.json taken from its config_json metadata, with the usual llm-jp-3-150m and Semantic-DACVAE-Japanese-32dim siblings), 40 steps, compared with the Python runtime (infer.py, fp32, CUDA, same text/seed/steps; log-mel over the common length):

request duration (audio.cpp / Python) mel cosine mel L1
no reference, automatic length (30 s, trimmed) 6.24 s / 6.24 s 0.9998 0.067
no reference, duration_sec=5 5.00 s / 5.00 s 0.9998 0.067
reference WAV, automatic length 6.36 s / 6.32 s 0.9873 0.591
control: no reference vs Python reference WAV 6.24 s / 6.32 s 0.7903 3.727

Before this PR the same model fails to load (message above), on CUDA and CPU. Repeating a request in the same server gives identical output, and the CPU backend gives the same lengths as CUDA (mel cosine 1.0000 against the CUDA output). The 30-second fallback is the slow path: 3.0 s against 0.7 s for duration_sec=5 on CUDA here, which the docs note.

No change for checkpoints with a duration predictor — byte-identical WAV output before and after this PR:

model requests
v4 Small q8_0 GGUF no reference; reference WAV; Speaker Inversion embedding, short and long (several chunks)
500M v3 q8_0 GGUF no reference; reference WAV
600M v3 VoiceDesign q8_0 GGUF with an instruction (caption-side duration path); no reference
CPU backend v4 Small no reference; 600M v3 VoiceDesign with an instruction

🤖 Generated with Claude Code

Checkpoints from before the duration predictor (the original 500M v2, and
models fine-tuned from it) have no duration_predictor.* weights and no
use_duration_predictor key. The Python runtime defaults the flag to False
and, without an explicit duration, generates 30 s and lets trim_tail cut the
trailing silence. audio.cpp defaulted it to true, so such a checkpoint
failed to load with "missing tensor: duration_predictor.token_input_proj.weight".

- use_duration_predictor defaults to false, as in Python. Every published
  irodori_tts package sets it to true explicitly.
- Without a predictor the condition encoder loads no duration weights and
  builds no duration graph. Its speaker/caption flag inputs feed only that
  graph, so they are not created either (unread graph inputs get no storage
  from gallocr).
- Weight validation asks for the caption-side duration tensors only when
  there is a predictor.
- resolve_sample_shape: no duration_sec and no predictor -> 30 s, as in
  Python.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@0xShug0
0xShug0 merged commit 3047fa4 into 0xShug0:main Oct 8, 2026
6 checks passed
@0xShug0

0xShug0 commented Oct 8, 2026

Copy link
Copy Markdown
Owner

@KKTTSPJ Thanks! PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants