From 3e0c8875118e14be7822b7aafa8fd83c80c5e3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Grunwald?= Date: Tue, 21 Jul 2026 10:09:20 +0200 Subject: [PATCH] [Bugfix] Fix Ovis2_5 special tokens for transformers v5 (#47298) Signed-off-by: mgrunwal Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --- vllm/model_executor/models/ovis2_5.py | 7 +++--- vllm/transformers_utils/processors/ovis2_5.py | 24 +++++++------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/vllm/model_executor/models/ovis2_5.py b/vllm/model_executor/models/ovis2_5.py index 6dbed78a6f..19dd047407 100644 --- a/vllm/model_executor/models/ovis2_5.py +++ b/vllm/model_executor/models/ovis2_5.py @@ -402,12 +402,11 @@ class Ovis2_5MultiModalProcessor(BaseMultiModalProcessor[Ovis2_5ProcessingInfo]) hf_processor_mm_kwargs: Mapping[str, object], out_mm_kwargs: MultiModalKwargsItems, ) -> list[PromptReplacement]: - tokenizer = self.info.get_tokenizer() - vocab = tokenizer.get_vocab() + hf_processor = self.info.get_hf_processor() placeholder = { - "image": vocab[IMAGE_TOKEN], - "video": vocab[VIDEO_TOKEN], + "image": hf_processor.get_token_value("image_token"), + "video": hf_processor.get_token_value("video_token"), } def get_replacement_ovis(item_idx, modality: str): diff --git a/vllm/transformers_utils/processors/ovis2_5.py b/vllm/transformers_utils/processors/ovis2_5.py index 11ac0360e7..b9c2d11240 100644 --- a/vllm/transformers_utils/processors/ovis2_5.py +++ b/vllm/transformers_utils/processors/ovis2_5.py @@ -78,7 +78,6 @@ class Ovis2_5Processor(ProcessorMixin): @cached_property def extra_special_tokens(self): - vocab = self.tokenizer.get_vocab() required_tokens = { "image_token": "", "video_token": "