mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-16 01:35:24 +08:00
[mrope][Qwen2-VL] Fix edge case where getting index of image/video token can potentially throw in default vl mrope implementation. (#23895)
Signed-off-by: Chenheli Hua <huachenheli@outlook.com>
This commit is contained in:
parent
b4f9e9631c
commit
2d0afcc9dc
@ -670,12 +670,18 @@ class MRotaryEmbedding(RotaryEmbedding):
|
|||||||
image_index, video_index = 0, 0
|
image_index, video_index = 0, 0
|
||||||
for _ in range(image_nums + video_nums):
|
for _ in range(image_nums + video_nums):
|
||||||
video_second_per_grid_t = 0.0
|
video_second_per_grid_t = 0.0
|
||||||
if image_token_id in input_tokens and remain_images > 0:
|
if remain_images > 0:
|
||||||
|
try:
|
||||||
ed_image = input_tokens.index(image_token_id, st)
|
ed_image = input_tokens.index(image_token_id, st)
|
||||||
|
except ValueError:
|
||||||
|
ed_image = len(input_tokens) + 1
|
||||||
else:
|
else:
|
||||||
ed_image = len(input_tokens) + 1
|
ed_image = len(input_tokens) + 1
|
||||||
if video_token_id in input_tokens and remain_videos > 0:
|
if remain_videos > 0:
|
||||||
|
try:
|
||||||
ed_video = input_tokens.index(video_token_id, st)
|
ed_video = input_tokens.index(video_token_id, st)
|
||||||
|
except ValueError:
|
||||||
|
ed_video = len(input_tokens) + 1
|
||||||
else:
|
else:
|
||||||
ed_video = len(input_tokens) + 1
|
ed_video = len(input_tokens) + 1
|
||||||
if ed_image < ed_video:
|
if ed_image < ed_video:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user