Skip to content

Commit

Permalink
Avoid negative values
Browse files Browse the repository at this point in the history
Signed-off-by: DarkLight1337 <[email protected]>
  • Loading branch information
DarkLight1337 committed Jan 3, 2025
1 parent b29f6ff commit fb8a2e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vllm/model_executor/models/llava_onevision.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _get_max_video_frames(
max_total_tokens = self.ctx.model_config.max_model_len
max_total_frames = int(max_total_tokens / self._get_max_frame_tokens())

return (max_total_frames - num_images * i2f) // max(num_videos, 1)
return max(max_total_frames - num_images * i2f, 0) // max(num_videos, 1)

def _get_max_video_tokens(self) -> int:
return self._get_max_frame_tokens() * self._get_max_video_frames()
Expand Down
2 changes: 1 addition & 1 deletion vllm/model_executor/models/qwen2_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def _get_max_video_frames(

max_total_tokens = self.ctx.model_config.max_model_len
max_total_frames = int(max_total_tokens / self._get_max_image_tokens())
return (max_total_frames - num_images * i2f) // max(num_videos, 1)
return max(max_total_frames - num_images * i2f, 0) // max(num_videos, 1)

def _get_max_video_tokens(self) -> int:
return self._get_max_image_tokens() * self._get_max_video_frames()
Expand Down

0 comments on commit fb8a2e1

Please sign in to comment.