SIGN IN SIGN UP

fix(kimi_k25_vl): keep PEFT expert LoRA keys under the base_model.model. prefix (#3431)

* fix(kimi_k25_vl): keep PEFT expert LoRA keys under the base_model.model. prefix

On a PEFT save the expert-LoRA conversion preserves the incoming fqn, which
already carries the "base_model.model." outer prefix, so re-wrapping the
result with "language_model." produced keys like
language_model.base_model.model.model.language_model.model.layers.N... —
nothing matches them on resume and the expert adapters were silently
dropped. Full-fine-tune expert weights still need the wrap because the
mixin resets those keys to the bare "model." prefix, so the wrap is now
skipped only for ".lora_" keys.

from_hf gains the reverse: keys in the "base_model." PEFT namespace are
routed through _recombine_lora_expert_keys so the per-expert adapter keys
merge back into the grouped tensors ModelState expects, making
save -> resume round-trip exactly.

Fixes #3385

Signed-off-by: stanley1208 <stanley.mei08@gmail.com>

* test(kimi_k25_vl): use the real GroupedExpertsLoRA tensor layouts in fixtures

Same shape transposition as flagged on the k3 PR: A is
[experts, in_features, rank] and B is [experts, rank, out_features], the
fixtures had them flipped, which made the gate/up split degenerate for
rank < inter and weakened what the round-trip test actually covered.

Signed-off-by: stanley1208 <stanley.mei08@gmail.com>

* test(kimi_k25_vl): verify PEFT expert adapter reload

Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>

---------

Signed-off-by: stanley1208 <stanley.mei08@gmail.com>
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
Co-authored-by: Yuhe Zhang <yuhez@nvidia.com>
S
stanley1208 committed
4b620ab0df59aa4fecbd112a807e458378eb0f2b
Parent: 14ef2e0
Committed by GitHub <noreply@github.com> on 8/7/2026, 5:13:31 AM