-
Notifications
You must be signed in to change notification settings - Fork 554
[Bug] internvl_hf: IndexError when visuals is empty list (video-only inputs) #1241
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Checklist
- I have searched for similar issues before opening this one.
- I am using the latest version of lmms-eval.
Bug Description
Bug Description
When running internvl_hf with video-only tasks (no images),
generate_until passes an empty list [] to self.processor(images=visuals, ...),
which causes an IndexError inside the processor.
Error Traceback
File "lmms_eval/models/chat/internvl_hf.py", line 270, in generate_until
inputs = self.processor(images=visuals, ...)
...
File "transformers/image_transforms.py", line 917, in group_images_by_shape
device = images[0][0].device if is_nested else images[0].device
IndexError: list index out of range
Root Cause
videos is already handled with a None guard, but visuals and image_sizes are not:
# Only videos is guarded — visuals is not
if len(videos) == 0:
videos = None
# This also crashes when visuals is []
gen_kwargs["image_sizes"] = [visuals[idx].size for idx in range(len(visuals))]Fix
# Before
if len(videos) == 0:
videos = None
inputs = self.processor(
images=visuals,
...
)
gen_kwargs["image_sizes"] = [visuals[idx].size for idx in range(len(visuals))]# After
if len(videos) == 0:
videos = None
if len(visuals) == 0:
visuals = None
inputs = self.processor(
images=visuals,
...
)
gen_kwargs["image_sizes"] = [visuals[idx].size for idx in range(len(visuals))] if visuals is not None else []Environment
- lmms-eval version: main branch
- Model:
internvl_hfwithOpenGVLab/InternVL3-8B-hf - Task type: video-only (no image inputs)
Steps to Reproduce
.Error Message / Traceback
.Environment
.
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working