@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / eaf7c9b976
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 6, 13:15 UTC

[CI] Fix PaddleOCR-VL HF test failure due to create_causal_mask API rename (#37328)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>

Andreas Karatzas committed Mar 18, 2026 at 04:44 UTC eaf7c9b976799c0d8e6b1ffd9bd4c0b6e74e988d
2 files changed +26
tests/models/multimodal/generation/test_common.py
+1
@@ -777,6 +777,7 @@ VLM_TEST_SETTINGS = {
777 max_model_len=8192,
778 max_num_seqs=2,
779 auto_cls=AutoModelForCausalLM,
780 + patch_hf_runner=model_utils.paddleocr_vl_patch_hf_runner,
781 image_size_factors=[(0.25,)],
782 marks=[
783 pytest.mark.skipif(
tests/models/multimodal/generation/vlm_utils/model_utils.py
+25
@@ -1149,6 +1149,31 @@ def ovis2_5_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
1149 return hf_model
1150
1151
1152 +def paddleocr_vl_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
1153 + """Patches the HfRunner to fix create_causal_mask API mismatch.
1154 +
1155 + The PaddleOCR-VL HF model passes `inputs_embeds` to create_causal_mask,
1156 + but transformers renamed this parameter to `input_embeds`.
1157 + """
1158 + import sys
1159 +
1160 + model_module = sys.modules.get(type(hf_model.model.model).__module__)
1161 + if model_module is None:
1162 + return hf_model
1163 +
1164 + original_create_causal_mask = getattr(model_module, "create_causal_mask", None)
1165 + if original_create_causal_mask is None:
1166 + return hf_model
1167 +
1168 + def patched_create_causal_mask(*args, **kwargs):
1169 + if "inputs_embeds" in kwargs:
1170 + kwargs["input_embeds"] = kwargs.pop("inputs_embeds")
1171 + return original_create_causal_mask(*args, **kwargs)
1172 +
1173 + model_module.create_causal_mask = patched_create_causal_mask # type: ignore[attr-defined]
1174 + return hf_model
1175 +
1176 +
1177 def qwen2_5_omni_patch_hf_runner(hf_model: HfRunner) -> HfRunner:
1178 """Patches and returns an instance of the HfRunner for Qwen2.5-Omni."""
1179 thinker = hf_model.model.thinker