From c0a25c089a1827a4a6f304fd10896b1b79585ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20P=C3=A9rez=20de=20Algaba?= <124347725+jperezdealgaba@users.noreply.github.com> Date: Thu, 20 Aug 2026 11:09:49 +0200 Subject: [PATCH] [Bugfix][Security] Guard _load_ov2_processor with resolve_trust_remote_code (#52952) Signed-off-by: jperezde --- vllm/model_executor/models/llava_onevision2.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/vllm/model_executor/models/llava_onevision2.py b/vllm/model_executor/models/llava_onevision2.py index c09b477f53..f094a168fb 100644 --- a/vllm/model_executor/models/llava_onevision2.py +++ b/vllm/model_executor/models/llava_onevision2.py @@ -39,7 +39,10 @@ import torch.nn as nn import torch.nn.functional as F from PIL import Image from transformers import AutoProcessor, AutoTokenizer, BatchFeature -from transformers.dynamic_module_utils import get_class_from_dynamic_module +from transformers.dynamic_module_utils import ( + get_class_from_dynamic_module, + resolve_trust_remote_code, +) from transformers.models.qwen2_vl import Qwen2VLImageProcessor from transformers.models.qwen2_vl.image_processing_qwen2_vl import smart_resize @@ -129,17 +132,22 @@ def _load_ov2_processor( path = convert_model_repo_to_path(model) revision = revision or "main" + resolve_trust_remote_code( + trust_remote_code, + model, + has_local_code=False, + has_remote_code=True, + ) + processor_cls = get_class_from_dynamic_module( "processing_llava_onevision2.LlavaOnevision2Processor", path, revision=revision, - trust_remote_code=trust_remote_code, ) video_processor_cls = get_class_from_dynamic_module( "video_processing_llava_onevision2.LlavaOnevision2VideoProcessor", path, revision=revision, - trust_remote_code=trust_remote_code, ) # Slow Qwen2VLImageProcessor mirrors the remote processor (the Fast variant