-
Notifications
You must be signed in to change notification settings - Fork 0
Vz/image count limit #2
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
1 issue found across 2 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
python/sglang/srt/server_args.py
Outdated
| sm_group_num: int = 3 | ||
|
|
||
| # Multimodal settings | ||
| max_num_image: Optional[int] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming mismatch between dataclass field max_num_image and CLI dest max_num_images will raise AttributeError during ServerArgs.from_cli_args.
Prompt for AI agents
Address the following comment on python/sglang/srt/server_args.py at line 273:
<comment>Naming mismatch between dataclass field `max_num_image` and CLI dest `max_num_images` will raise AttributeError during `ServerArgs.from_cli_args`.</comment>
<file context>
@@ -269,6 +269,9 @@ class ServerArgs:
enable_pdmux: bool = False
sm_group_num: int = 3
+ # Multimodal settings
+ max_num_image: Optional[int] = None
+
def __post_init__(self):
</file context>
| max_num_image: Optional[int] = None | |
| max_num_images: Optional[int] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
2 issues found across 2 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| num_images = len(image_data) if image_data else 0 | ||
| if not image_data or num_images == 0: | ||
| return [] | ||
| if num_images > self.IMAGE_NUM_LIMITATION: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparing num_images to self.IMAGE_NUM_LIMITATION will raise TypeError when the limit is not set (None). Guard the comparison with a None check.
Prompt for AI agents
Address the following comment on python/sglang/srt/multimodal/processors/base_processor.py at line 257:
<comment>Comparing num_images to self.IMAGE_NUM_LIMITATION will raise TypeError when the limit is not set (None). Guard the comparison with a None check.</comment>
<file context>
@@ -249,8 +251,15 @@ def get_estimated_frames_list(self, image_data):
from decord import VideoReader, cpu
# Before processing inputs
- if not image_data or len(image_data) == 0:
+ num_images = len(image_data) if image_data else 0
+ if not image_data or num_images == 0:
return []
+ if num_images > self.IMAGE_NUM_LIMITATION:
+ raise ValueError(
</file context>
| if num_images > self.IMAGE_NUM_LIMITATION: | |
| if self.IMAGE_NUM_LIMITATION is not None and num_images > self.IMAGE_NUM_LIMITATION: |
| help="Disable mmap while loading weight using safetensors.", | ||
| ) | ||
| parser.add_argument( | ||
| "--max-num-images", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CLI option produces an argparse destination name (max_num_images) that does not match the dataclass field max_num_image, causing ServerArgs.from_cli_args to raise AttributeError at runtime.
Prompt for AI agents
Address the following comment on python/sglang/srt/server_args.py at line 1817:
<comment>The CLI option produces an argparse destination name (`max_num_images`) that does not match the dataclass field `max_num_image`, causing `ServerArgs.from_cli_args` to raise `AttributeError` at runtime.</comment>
<file context>
@@ -1810,6 +1813,12 @@ def add_cli_args(parser: argparse.ArgumentParser):
action="store_true",
help="Disable mmap while loading weight using safetensors.",
)
+ parser.add_argument(
+ "--max-num-images",
+ type=int,
+ default=None,
</file context>
| "--max-num-images", | |
| "--max-num-images", dest="max_num_image", |
@vincentzed I've started the AI code review. It'll take a few minutes to complete. |
1 similar comment
@vincentzed I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
No issues found across 3 files. Review in cubic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
1 issue found across 3 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
|
|
||
| num_images = len(image_data) | ||
| if num_images > max_num_images: | ||
| raise ValueError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raising ValueError here causes the client to receive a generic 500 InternalServerError instead of a clear 4xx validation response; raise HTTPException(400) or return a validation message instead
Prompt for AI agents
Address the following comment on python/sglang/srt/entrypoints/openai/serving_chat.py at line 80:
<comment>Raising ValueError here causes the client to receive a generic 500 InternalServerError instead of a clear 4xx validation response; raise HTTPException(400) or return a validation message instead</comment>
<file context>
@@ -69,6 +69,20 @@ def _validate_request(self, request: ChatCompletionRequest) -> Optional[str]:
return None
+ def _validate_image_count(self, image_data: List[Any]) -> None:
+ """Validate that the number of images doesn't exceed the configured limit"""
+ max_num_images = self.tokenizer_manager.server_args.max_num_images
+ if max_num_images is None:
+ return
+
</file context>
|
@cubic-dev-ai review the new function more in depth |
@vincentzed I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
No issues found across 2 files. Review in cubic
Co-authored-by: jiapingW <[email protected]>
…#10171) Signed-off-by: Shangming Cai <[email protected]> Co-authored-by: hzh0425 <[email protected]> Co-authored-by: Shangming Cai <[email protected]>
…#9987) Co-authored-by: Xiang (Kevin) Li <[email protected]>
Signed-off-by: Xuchun Shang <[email protected]> Co-authored-by: Teng Ma <[email protected]>
…end (sgl-project#10273) Signed-off-by: Shangming Cai <[email protected]>
Signed-off-by: Shangming Cai <[email protected]>
Co-authored-by: fujianhao.fjh <[email protected]>
Signed-off-by: Shahar Mor <[email protected]>
…n-static (sgl-project#10975) Co-authored-by: sglang-bot <[email protected]>
…gistry (sgl-project#10816) Co-authored-by: Yi Zhang <[email protected]>
Thanks to MiniMax Team and Chenyang Zhao's support.
Co-authored-by: Chang Su <[email protected]>
Co-authored-by: Simo Lin <[email protected]>
…#11099) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Cheng Wan <[email protected]>
…prob_start_len = -1` (sgl-project#11113)
Motivation
Modifications
Accuracy Test
Benchmark & Profiling
Checklist