Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resize for minimal smart resize
Browse files Browse the repository at this point in the history
kcz358 committed Jan 31, 2025
1 parent cde6408 commit 7660719
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lmms_eval/models/kino.py
Original file line number Diff line number Diff line change
@@ -284,6 +284,14 @@ def _collate(x):
eval_logger.info(f"Error {e} when loading video : {visuals}")
pbar.update(1)
elif isinstance(visual, PIL.Image.Image):
height = visual.size[0]
width = visual.size[1]
if width < 28 and height < 28:
visual = visual.resize((28, 28))
elif height < 28:
visual = visual.resize((28, width))
elif width < 28:
visual = visual.resize((height, 28))
images.append(visual)
elif isinstance(visual, dict) and "array" in visual:
audios.append(downsample_audio(visual["array"], visual["sampling_rate"], self._processor.audio_processor.sampling_rate))

0 comments on commit 7660719

Please sign in to comment.