mirror of
https://github.com/turboderp-org/exllamav2.git
synced 2026-03-15 00:07:26 +00:00
Fix rounding error in Pixtral image preprocessor
This commit is contained in:
@@ -19,7 +19,7 @@ def preprocess(
|
||||
assert "longest_edge" in config.vision_size, \
|
||||
"preprocessing size must specify longest_edge"
|
||||
|
||||
patch_size = tuple(config.vision_patch_size[d] for d in ["height", "width"])
|
||||
patch_size = tuple(config.vision_patch_size[d] * 2 for d in ["height", "width"])
|
||||
longest_edge = config.vision_size["longest_edge"]
|
||||
resample = Image.Resampling(config.vision_resample)
|
||||
image_mean = tuple(config.vision_image_mean)
|
||||
|
||||
@@ -36,7 +36,7 @@ def size_to_longest_edge_and_patch_size(
|
||||
|
||||
ratio = max(input_size[0] / max_size[0], input_size[1] / max_size[1])
|
||||
if ratio > 1:
|
||||
output_size = tuple(int(np.ceil(d / ratio)) for d in input_size)
|
||||
output_size = tuple(max(1, int(np.floor(d / ratio))) for d in input_size)
|
||||
else:
|
||||
output_size = input_size
|
||||
|
||||
|
||||
Reference in New Issue
Block a user