trinity.common.patch.kimi module#
Monkey patching for âkimi_vlâ models.
- trinity.common.patch.kimi.kimi_vl_monkey_patch_decorator(func)[source]#
A decorator that applies temporary monkey patches for âkimi_vlâ models before the decorated function runs, and restores the original state afterward.
- The patch is applied only if:
The modelâs config.json exists and specifies âmodel_typeâ: âkimi_vlâ
The installed transformers version is >= 4.51.0
- Patches include:
Replacing transformers.activations.PytorchGELUTanh with GELUTanh
Wrapping importlib.util.spec_from_file_location to inject DeepseekV3 classes
The decorator automatically extracts model_path and override_model_config from the functionâs arguments using inspect.signature, regardless of whether they are passed as positional or keyword arguments.