KModel loads mismatched checkpoints silently via strict=False
Summary
KModel loads checkpoint state dicts with a silent strict=False fallback. A finetuned checkpoint saved in the newer torch.nn.utils.parametrizations.weight_norm format uses keys such as *.parametrizations.weight.original0 / *.parametrizations.weight.original1, instead of the *.weight_g / *.weight_v keys the model's modules expect. Because loading is not strict, such a checkpoint "loads successfully" but leaves every weight-norm layer at its random initialization. The result is pure noise instead of speech, with no error and no warning. This affects at least one publicly available finetune family for a non-English language (e.g. the "kikiri-tts" checkpoints).
Environment
- kokoro 0.7.16
- PyTorch 2.x
- Python 3.13
- macOS arm64 (Apple Silicon, M1 Max)
Reproduction
- Load such a checkpoint directly into
KModel— output is noise, with no error or warning raised. - Remap the keys (
original0->weight_g,original1->weight_v) and callload_state_dict(strict=True)per component — output is then correct speech.
Expected vs. Actual
- Expected: a checkpoint whose keys don't cover the model's parameters should fail loudly, or at least warn, rather than "succeed" with randomly-initialized layers.
- Actual: the silent
strict=Falsefallback accepts partial/mismatched checkpoints with no diagnostic, producing a model that runs but only emits noise.
Suggestion
Check key coverage when loading and fail loudly (or warn clearly) on incomplete coverage, or expose a strict option to callers. Optionally, detect and remap the parametrizations.weight.* naming directly, since it is a standard PyTorch parametrization format.
Source: hexgrad/kokoro