[Bugfix][Security] Guard _load_ov2_processor with resolve_trust_remote_code (#52952)
Signed-off-by: jperezde <jperezde@redhat.com>
Juan Pérez de Algaba committed
Aug 20, 2026 at 11:09 UTC
c0a25c089a1827a4a6f304fd10896b1b79585ef1
1 file changed
+11
-3
vllm/model_executor/models/llava_onevision2.py
+11
-3
@@ -39,7 +39,10 @@ import torch.nn as nn
39
import torch.nn.functional as F
40
from PIL import Image
41
from transformers import AutoProcessor, AutoTokenizer, BatchFeature
42
-from transformers.dynamic_module_utils import get_class_from_dynamic_module
42
+from transformers.dynamic_module_utils import (
43
+ get_class_from_dynamic_module,
44
+ resolve_trust_remote_code,
45
+)
46
from transformers.models.qwen2_vl import Qwen2VLImageProcessor
47
from transformers.models.qwen2_vl.image_processing_qwen2_vl import smart_resize
48
@@ -129,17 +132,22 @@ def _load_ov2_processor(
132
path = convert_model_repo_to_path(model)
133
revision = revision or "main"
134
135
+ resolve_trust_remote_code(
136
+ trust_remote_code,
137
+ model,
138
+ has_local_code=False,
139
+ has_remote_code=True,
140
+ )
141
+
142
processor_cls = get_class_from_dynamic_module(
143
"processing_llava_onevision2.LlavaOnevision2Processor",
144
path,
145
revision=revision,
136
- trust_remote_code=trust_remote_code,
146
)
147
video_processor_cls = get_class_from_dynamic_module(
148
"video_processing_llava_onevision2.LlavaOnevision2VideoProcessor",
149
path,
150
revision=revision,
142
- trust_remote_code=trust_remote_code,
151
)
152
153
# Slow Qwen2VLImageProcessor mirrors the remote processor (the Fast variant