Skip to content

Commit 35d6536

Browse files
Refine Ovis padding
1 parent a3d8fa9 commit 35d6536

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

vllm/model_executor/models/ovis2_5.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,15 @@ def find_padding(self, h_orig, w_orig, desired_patches):
477477
if desired_patches % h_orig == 0:
478478
best_pad_h = 0
479479
w_factor = desired_patches // h_orig
480-
best_pad_w = w_factor - w_orig if (w_factor > w_orig
481-
and w_factor % 2 == 0) else 0
480+
best_pad_w = (w_factor - w_orig if
481+
(w_factor > w_orig and w_factor %
482+
self.config.vit_config.hidden_stride == 0) else 0)
482483
elif desired_patches % w_orig == 0:
483484
best_pad_w = 0
484485
h_factor = desired_patches // w_orig
485-
best_pad_h = h_factor - h_orig if (h_factor > h_orig
486-
and h_factor % 2 == 0) else 0
486+
best_pad_h = (h_factor - h_orig if
487+
(h_factor > h_orig and h_factor %
488+
self.config.vit_config.hidden_stride == 0) else 0)
487489
elif desired_patches % h_orig != 0 and desired_patches % w_orig != 0:
488490
if h_orig > w_orig:
489491
w_factor = self.find_factor(desired_patches, w_orig)

0 commit comments

Comments
 (0)