sgl-project/sglang · error · ValueError
Step3-VL image item has num_patches > 0 but no patch_pixel_v
Error message
Step3-VL image item has num_patches > 0 but no patch_pixel_values.
What it means
Step3-VL-10B mirror of the patch-feature guard: an image with num_patch > 0 must come with patch pixel features; when item_patch_features is None the loop raises ValueError because patch features are required to assemble the output.
Source
Thrown at python/sglang/srt/models/step3_vl_10b.py:557
patch_offset = 0
for thumb_count, num_patches_list, patch_count in item_metadata:
item_thumb_features = all_thumb_features[
thumb_offset : thumb_offset + thumb_count
]
thumb_offset += thumb_count
item_patch_features = (
all_patch_features[patch_offset : patch_offset + patch_count]
if patch_count > 0
else None
)
patch_offset += patch_count
cur_patch_idx = 0
for i, num_patch in enumerate(num_patches_list):
cur_feature = []
if num_patch > 0:
if item_patch_features is None:
raise ValueError(
"Step3-VL image item has num_patches > 0 but no patch_pixel_values."
)
patch_slice = item_patch_features[
cur_patch_idx : cur_patch_idx + num_patch
]
cur_feature.append(patch_slice.view(-1, patch_slice.shape[-1]))
cur_feature.append(
item_thumb_features[i].view(-1, item_thumb_features.shape[-1])
)
cur_patch_idx += num_patch
merged_image_features.append(
torch.cat(cur_feature) if len(cur_feature) > 1 else cur_feature[0]
)
return self._flatten_embeddings(merged_image_features)
def pad_input_ids(self, input_ids: List[int], mm_inputs: MultimodalInputs):
pattern = MultiModalityDataPaddingPatternMultimodalTokens()
return pattern.pad_input_tokens(input_ids, mm_inputs)View on GitHub (pinned to 0132848349)
Solutions
- Provide patch_pixel_values/patch features for every image with num_patches > 0
- Zero out num_patches when patch inputs are intentionally omitted
- Keep processor and model code from the same release
Example fix
# before
item.model_specific_data = {"num_patches": [2, 1]}
# after
item.model_specific_data = {"num_patches": [2, 1], "patch_pixel_values": patches} Defensive patterns
Strategy: validation
Validate before calling
assert item_patch_features is not None or all(n == 0 for n in num_patches_list)
Prevention
- Never emit positive num_patches without patch pixel tensors
When it happens
Trigger: num_patches_list containing positive counts while patch pixel features are missing for that item in step3_vl_10b.get_image_feature (python/sglang/srt/models/step3_vl_10b.py:557).
Common situations: Preprocessor emitting patch counts but not patch pixels across versions; trimming patch inputs manually; DP/EP pipelines dropping the patch tensor.
Related errors
- Step3-VL image item has num_patches > 0 but no patch_pixel_v
- Step3-VL image item is missing num_patches.
- cos/sin shape does not cover image tokens and head_dim
- Unsupported image type: {type(image)}
- QwenImageEditPlus expects either one shared condition image
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/23565ccace9703d4.
Report an issue: GitHub.