Skip to content

Commit

Permalink
fix copies
Browse files Browse the repository at this point in the history
  • Loading branch information
leloykun committed Aug 17, 2024
1 parent 10d0aea commit 1380596
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def get_resize_output_image_size(
new_width = scale * new_width

new_height, new_width = int(new_height + 0.5), int(new_width + 0.5)
new_height = new_height // size_divisor * size_divisor
new_width = new_width // size_divisor * size_divisor
new_height = max(1, new_height // size_divisor) * size_divisor
new_width = max(1, new_width // size_divisor) * size_divisor

return new_height, new_width

Expand Down
2 changes: 0 additions & 2 deletions src/transformers/models/vilt/image_processing_vilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,9 @@ def resize(
size = get_size_dict(size, default_to_square=False)
shorter = size["shortest_edge"] if "shortest_edge" in size else min(size["height"], size["width"])
longer = int(1333 / 800 * shorter)
print(f"{shorter = } | {longer = }")
output_size = get_resize_output_image_size(
image, shorter=shorter, longer=longer, size_divisor=size_divisor, input_data_format=input_data_format
)
print(f"{output_size = }")
return resize(
image,
size=output_size,
Expand Down

0 comments on commit 1380596

Please sign in to comment.