From 1f963d7f64de58c9fcb0c7b0a8ba76d89ca254b4 Mon Sep 17 00:00:00 2001 From: Yi Zhang <1109276519@qq.com> Date: Sat, 26 Apr 2025 23:18:02 +0800 Subject: [PATCH] Bugfix for minicpmo vision test (#5760) --- python/sglang/srt/managers/multimodal_processors/minicpm.py | 2 +- python/sglang/srt/managers/schedule_batch.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/managers/multimodal_processors/minicpm.py b/python/sglang/srt/managers/multimodal_processors/minicpm.py index 0f189b7be..35b41bab4 100644 --- a/python/sglang/srt/managers/multimodal_processors/minicpm.py +++ b/python/sglang/srt/managers/multimodal_processors/minicpm.py @@ -97,7 +97,7 @@ class MiniCPMMultimodalProcessor(BaseMultimodalProcessor): audio_start_id = tokenizer.audio_start_id audio_end_id = tokenizer.audio_end_id - im_token_id = tokenizer.unk_token_id + im_token_id = tokenizer.unk_id pixel_values = res["pixel_values"] tgt_sizes = res["tgt_sizes"] diff --git a/python/sglang/srt/managers/schedule_batch.py b/python/sglang/srt/managers/schedule_batch.py index 6b8506ddc..4b51a09d7 100644 --- a/python/sglang/srt/managers/schedule_batch.py +++ b/python/sglang/srt/managers/schedule_batch.py @@ -374,6 +374,12 @@ class MultimodalInputs: self.mrope_position_delta = torch.cat( [self.mrope_position_delta, other.mrope_position_delta], dim=0 ) + + for key, val in other.__dict__.items(): + if "_id" in key: + # set token_ids + if getattr(self, key, None) is None: + setattr(self, key, getattr(other, key, None)) # other args would be kept intact