trinity.common.patch package#
Submodules#
Module contents#
- trinity.common.patch.kimi_vl_monkey_patch_decorator(func)[源代码]#
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.