From 5752f25eef583cc97a961d0e625c7bf46f8526af Mon Sep 17 00:00:00 2001 From: Xiao Yu <39458711+jasonyux@users.noreply.github.com> Date: Wed, 18 Sep 2024 03:46:32 -0400 Subject: [PATCH] Fixed n>1 causing list index out of range with VLM (#1449) --- python/sglang/srt/managers/io_struct.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/sglang/srt/managers/io_struct.py b/python/sglang/srt/managers/io_struct.py index 08e43ea08..1c6994d77 100644 --- a/python/sglang/srt/managers/io_struct.py +++ b/python/sglang/srt/managers/io_struct.py @@ -133,6 +133,9 @@ class GenerateReqInput: self.image_data = [None] * num elif not isinstance(self.image_data, list): self.image_data = [self.image_data] * num + elif isinstance(self.image_data, list): + # multi-image with n > 1 + self.image_data = self.image_data * num if self.sampling_params is None: self.sampling_params = [{}] * num