Skip to content

Commit

Permalink
Update modeling_llava_next_video.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrilvallez committed Oct 31, 2024
1 parent cc58d43 commit f05849a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ def unpad_image(tensor, original_size):

if original_aspect_ratio > current_aspect_ratio:
scale_factor = current_width / original_width
new_height = int(original_height * scale_factor)
new_height = int(round(original_height * scale_factor, 7))
padding = (current_height - new_height) // 2
unpadded_tensor = tensor[:, padding : current_height - padding, :]
else:
scale_factor = current_height / original_height
new_width = int(original_width * scale_factor)
new_width = int(round(original_width * scale_factor, 7))
padding = (current_width - new_width) // 2
unpadded_tensor = tensor[:, :, padding : current_width - padding]

Expand Down

0 comments on commit f05849a

Please sign in to comment.