SIGN IN SIGN UP

refactor(checkpoint): StateDictAdapter method target-module rename (#3591)

refactor(checkpoint): make the target-module rename hook a StateDictAdapter method

Follow-up to #3435. The rename hook for adapter_config.json's
target_modules was discovered with getattr in _extract_target_modules,
which is easy to miss when writing a new adapter. It's now a regular
method on the StateDictAdapter base that returns the name unchanged, so
adapters whose to_hf renames modules just override it (kimi_k3 already
does) and addons.py calls it through an isinstance check instead.

Legacy adapters that don't subclass StateDictAdapter (llama, qwen2/3,
kimivl, and the mixin-only test adapters) skip the hook like they did
with the old getattr guard, so their PEFT saves keep working.

Signed-off-by: stanley1208 <stanley.mei08@gmail.com>
Co-authored-by: Alexandros Koumparoulis <153118171+akoumpa@users.noreply.github.com>
S
Stanley Mei committed
b3375b84a15ee7d3f8db6bd7cc970a52b6013aa4
Parent: 9fb9297
Committed by GitHub <noreply@github.com> on 8/24/2026, 4:25:17 PM