Reduce the image processing latency in VLM (#11541)

Co-authored-by: qiuxuan.lzw <qiuxuan.lzw@alibaba-inc.com>
This commit is contained in:
StonyPort
2025-10-17 06:00:03 +08:00
committed by GitHub
parent b0d1d717e1
commit fd389df96e
3 changed files with 16 additions and 3 deletions

View File

@@ -313,7 +313,9 @@ class BaseMultimodalProcessor(ABC):
try:
if modality == Modality.IMAGE:
img, _ = load_image(data)
return img.convert("RGB") if discard_alpha_channel else img
if discard_alpha_channel and img.mode != "RGB":
img = img.convert("RGB")
return img
elif modality == Modality.VIDEO:
return load_video(data, frame_count_limit)
elif modality == Modality.AUDIO: