mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 22:32:54 +08:00
[misc] update mm plugin (#6691)
Former-commit-id: c0caa7afc60ed3015fe6c263ba3566202ba934f1
This commit is contained in:
parent
bbf334f823
commit
f87c788154
@ -91,7 +91,7 @@ class BasePlugin:
|
||||
if (image.width * image.height) > image_resolution:
|
||||
resize_factor = math.sqrt(image_resolution / (image.width * image.height))
|
||||
width, height = int(image.width * resize_factor), int(image.height * resize_factor)
|
||||
image = image.resize((width, height), resample=Image.NEAREST)
|
||||
image = image.resize((width, height), resample=Image.Resampling.NEAREST)
|
||||
|
||||
if image.mode != "RGB":
|
||||
image = image.convert("RGB")
|
||||
@ -780,15 +780,15 @@ class Qwen2vlPlugin(BasePlugin):
|
||||
image = super()._preprocess_image(image, **kwargs)
|
||||
if min(image.width, image.height) < 28:
|
||||
width, height = max(image.width, 28), max(image.height, 28)
|
||||
image = image.resize((width, height), resample=Image.NEAREST)
|
||||
image = image.resize((width, height), resample=Image.Resampling.NEAREST)
|
||||
|
||||
if image.width / image.height > 200:
|
||||
width, height = image.height * 180, image.height
|
||||
image = image.resize((width, height), resample=Image.NEAREST)
|
||||
image = image.resize((width, height), resample=Image.Resampling.NEAREST)
|
||||
|
||||
if image.height / image.width > 200:
|
||||
width, height = image.width, image.width * 180
|
||||
image = image.resize((width, height), resample=Image.NEAREST)
|
||||
image = image.resize((width, height), resample=Image.Resampling.NEAREST)
|
||||
|
||||
return image
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user