fix: register kimi_k25 and kimi_vl configs eagerly in lazy registry#1579
Merged
fix: register kimi_k25 and kimi_vl configs eagerly in lazy registry#1579
Conversation
…ote_code errors The new lazy registry (MODEL_ARCH_MAPPING + _LazyArchMapping) does not import model modules at startup, so _register_*_with_transformers() never fires before AutoConfig.from_pretrained is called. This causes local checkpoints with auto_map in config.json to require trust_remote_code=True even though we have custom implementations. Changes: - Add kimi_k25 and kimi_vl to _CUSTOM_CONFIG_REGISTRATIONS so their config classes are registered in CONFIG_MAPPING at import time. - Add KimiK25ForConditionalGeneration as an architecture alias in MODEL_ARCH_MAPPING (the checkpoint uses this name, while the NeMo implementation is KimiK25VLForConditionalGeneration). Signed-off-by: HuiyingLi <willwin.lee@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Contributor
Author
|
/ok to test bf3d2cc |
Contributor
Author
|
/claude review |
Contributor
Author
|
/ok to test d033405 |
Contributor
Author
|
/ok to test cb02151 |
akoumpa
approved these changes
Mar 20, 2026
torsli
pushed a commit
that referenced
this pull request
Mar 24, 2026
…1579) fix: register kimi_k25 and kimi_vl configs eagerly to avoid trust_remote_code errors The new lazy registry (MODEL_ARCH_MAPPING + _LazyArchMapping) does not import model modules at startup, so _register_*_with_transformers() never fires before AutoConfig.from_pretrained is called. This causes local checkpoints with auto_map in config.json to require trust_remote_code=True even though we have custom implementations. Changes: - Add kimi_k25 and kimi_vl to _CUSTOM_CONFIG_REGISTRATIONS so their config classes are registered in CONFIG_MAPPING at import time. - Add KimiK25ForConditionalGeneration as an architecture alias in MODEL_ARCH_MAPPING (the checkpoint uses this name, while the NeMo implementation is KimiK25VLForConditionalGeneration). Signed-off-by: HuiyingLi <willwin.lee@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
linnanwang
pushed a commit
that referenced
this pull request
Apr 24, 2026
…1579) fix: register kimi_k25 and kimi_vl configs eagerly to avoid trust_remote_code errors The new lazy registry (MODEL_ARCH_MAPPING + _LazyArchMapping) does not import model modules at startup, so _register_*_with_transformers() never fires before AutoConfig.from_pretrained is called. This causes local checkpoints with auto_map in config.json to require trust_remote_code=True even though we have custom implementations. Changes: - Add kimi_k25 and kimi_vl to _CUSTOM_CONFIG_REGISTRATIONS so their config classes are registered in CONFIG_MAPPING at import time. - Add KimiK25ForConditionalGeneration as an architecture alias in MODEL_ARCH_MAPPING (the checkpoint uses this name, while the NeMo implementation is KimiK25VLForConditionalGeneration). Signed-off-by: HuiyingLi <willwin.lee@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kimi_k25andkimi_vlto_CUSTOM_CONFIG_REGISTRATIONSso their config classes are registered inCONFIG_MAPPINGat import time, avoidingtrust_remote_code=Trueerrors when loading local checkpoints withauto_mapinconfig.json.KimiK25ForConditionalGenerationas an architecture alias inMODEL_ARCH_MAPPING(the checkpoint uses this name, while the NeMo implementation isKimiK25VLForConditionalGeneration)._LazyArchMapping) does not import model modules at startup, so_register_*_with_transformers()never fires beforeAutoConfig.from_pretrainedis called. The old eager registry (pkgutil.walk_packages) imported all model modules on startup which masked this issue.Test plan
test_custom_config_registrations_in_config_mapping— verifies all entries in_CUSTOM_CONFIG_REGISTRATIONSare registered inCONFIG_MAPPINGtest_kimi_k25_arch_alias_in_model_arch_mapping— verifiesKimiK25ForConditionalGenerationmaps toKimiK25VLForConditionalGenerationpytest tests/unit_tests/_transformers/test_registry.py)torchrun --nproc_per_node=8withkimi25vl_cordv2_2layer.yaml(kimi_k25) trains successfullytorchrun --nproc_per_node=8withkimi2vl_cordv2.yaml(kimi_vl) trains successfully🤖 Generated with Claude Code