Skip to content

KModel loads mismatched checkpoints silently via strict=False #368

Description

@seigoryu

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

  1. Load such a checkpoint directly into KModel — output is noise, with no error or warning raised.
  2. Remap the keys (original0 -> weight_g, original1 -> weight_v) and call load_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=False fallback 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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions