Skip to content

Commit 3f2f542

Browse files
skyloevildeitxfge
andcommitted
Replace incorrect EVS fallback with explicit error
The fallback logic in iter_mm_grid_hw had several issues: 1. Token distribution inconsistency: Used uniform distribution (total // t) instead of first-frame-full distribution used by the processor 2. Incorrect offset calculation: Only counted video_pad tokens, ignored timestamp and start/end tokens in the placeholder 3. Should never trigger: Processor always generates is_embed mask Replace with RuntimeError to catch bugs early if mask is missing. Based on code review feedback. Co-Authored-By: deitxfge <[email protected]>
1 parent 3fafdcd commit 3f2f542

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

vllm/model_executor/models/qwen3_vl.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,19 +1632,14 @@ def iter_mm_grid_hw(
16321632
yield offset + rel_offset, llm_grid_h, llm_grid_w
16331633
continue
16341634

1635-
# Fallback: distribute offsets uniformly when mask is missing
1636-
tokens_per_frame_original = llm_grid_h * llm_grid_w
1637-
total_retained_tokens = compute_retained_tokens_count(
1638-
tokens_per_frame_original, t, self.video_pruning_rate
1635+
# If EVS is enabled but mask is missing, this indicates a bug
1636+
# in the prompt processing pipeline. The is_embed mask should
1637+
# always be present when video_pruning_rate > 0.
1638+
raise RuntimeError(
1639+
f"EVS is enabled (pruning_rate={self.video_pruning_rate}) "
1640+
"but is_embed mask is missing from mm_position. "
1641+
"This indicates a bug in prompt processing."
16391642
)
1640-
tokens_per_frame = (
1641-
total_retained_tokens // t
1642-
if t > 0
1643-
else tokens_per_frame_original
1644-
)
1645-
for _ in range(t):
1646-
yield offset, llm_grid_h, llm_grid_w
1647-
offset += tokens_per_frame
16481643
else:
16491644
# Non-EVS mode: Use original logic with input_tokens.index()
16501645
for _ in range(t):

0 commit comments

Comments
 (0)