From caef0a8937da1d1f76b4a9e52da72511425831a4 Mon Sep 17 00:00:00 2001 From: hoshi-hiyouga Date: Tue, 4 Mar 2025 00:17:06 +0800 Subject: [PATCH] [data] use bicubic resampler (#7143) Former-commit-id: bc298c60b7d3fdc4d116a79b535d7e9b11f4aa65 --- src/llamafactory/data/mm_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/llamafactory/data/mm_plugin.py b/src/llamafactory/data/mm_plugin.py index 133984cd..bc6e1afe 100644 --- a/src/llamafactory/data/mm_plugin.py +++ b/src/llamafactory/data/mm_plugin.py @@ -125,12 +125,12 @@ class MMPluginMixin: if (image.width * image.height) > image_max_pixels: resize_factor = math.sqrt(image_max_pixels / (image.width * image.height)) width, height = int(image.width * resize_factor), int(image.height * resize_factor) - image = image.resize((width, height), resample=Image.Resampling.NEAREST) + image = image.resize((width, height)) if (image.width * image.height) < image_min_pixels: resize_factor = math.sqrt(image_min_pixels / (image.width * image.height)) width, height = int(image.width * resize_factor), int(image.height * resize_factor) - image = image.resize((width, height), resample=Image.Resampling.NEAREST) + image = image.resize((width, height)) if image.mode != "RGB": image = image.convert("RGB")