Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed n>1 causing list index out of range with VLM #1449

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

jasonyux
Copy link
Contributor

@jasonyux jasonyux commented Sep 17, 2024

Motivation

When using VLM inference (e.g., the ones in test/srt/test_vision_openai_server.py), changing n=1 to n>1 will cause the following error:

(other error message omitted)
  File "/home/docker/.local/lib/python3.10/site-packages/sglang/srt/managers/tokenizer_manager.py", line 351, in _handle_batch_request
    await self._get_pixel_values(obj.image_data[index])
IndexError: list index out of range

Modifications

After printing out a few things, I find that this is because obj.image_data is not cloned into batches, unlike obj.sampling_params. So simply changing to obj.image_data worked.


Edit 1: the above will cause errors when facing batch requests. So instead of removing indexing, just clone the obj.image_data in a similar way as how other fields are cloned (e.g., obj.sampling_params)

Checklist

  • Format your code according to the Contributor Guide.
  • Add unit tests as outlined in the Contributor Guide.
  • Update documentation as needed, including docstrings or example tutorials.

@merrymercy merrymercy enabled auto-merge (squash) September 17, 2024 22:39
@merrymercy
Copy link
Contributor

merrymercy commented Sep 17, 2024

@jasonyux Can you fix the errors in CI? You can reproduce it by

python3 sglang/test/srt/test_openai_server.py

@jasonyux
Copy link
Contributor Author

sure. I am working on it.

auto-merge was automatically disabled September 18, 2024 02:04

Head branch was pushed to by a user without write access

@merrymercy merrymercy enabled auto-merge (squash) September 18, 2024 07:46
@merrymercy merrymercy disabled auto-merge September 18, 2024 07:46
@merrymercy merrymercy merged commit 5752f25 into sgl-project:main Sep 18, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants