bridge.models.kimi_vl.kimi_k25_vl_bridge#
Module Contents#
Classes#
Megatron Bridge for Kimi K2.5 VL. |
API#
- class bridge.models.kimi_vl.kimi_k25_vl_bridge.KimiK25VLBridge#
Bases:
megatron.bridge.models.conversion.model_bridge.MegatronModelBridgeMegatron Bridge for Kimi K2.5 VL.
Converts HuggingFace Kimi K2.5 VL models (KimiK25ForConditionalGeneration) to Megatron format (KimiK25VLModel) and vice versa.
The language backbone shares the same architecture as Kimi K2 (MoE with MLA).
- provider_bridge(
- hf_pretrained: megatron.bridge.models.hf_pretrained.vlm.PreTrainedVLM,
- _load_and_dequantize(
- key: str,
- hf_state_dict: Mapping[str, torch.Tensor],
Load a weight, dequantizing INT4 packed tensors when present.
- maybe_modify_loaded_hf_weight(
- hf_param: str | dict[str, str],
- hf_state_dict: Mapping[str, torch.Tensor],
Load HF weights, dequantizing INT4 quantized tensors when present.
- _is_quantized_expert_key(key: str) bool#
- maybe_modify_converted_hf_weight(
- task: megatron.bridge.models.conversion.model_bridge.WeightConversionTask,
- converted_weights_dict: Dict[str, torch.Tensor],
- hf_state_dict: Mapping[str, torch.Tensor],
Re-quantize converted expert weights to INT4 format.
- build_conversion_tasks(hf_pretrained, megatron_model) List#
Override to synthesize virtual weight keys from INT4 quantized triplets.
The HF checkpoint stores quantized expert weights as triplets (weight_packed, weight_scale, weight_shape) without a plain ‘weight’ key. We synthesize virtual ‘weight’ keys so the mapping registry can find them, then maybe_modify_loaded_hf_weight handles dequantization at load time.
- mapping_registry() megatron.bridge.models.conversion.mapping_registry.MegatronMappingRegistry#