From 8fd1eeda10d1fbc458448313ca3d565369f7428a Mon Sep 17 00:00:00 2001 From: audioXD Date: Mon, 25 Aug 2025 19:09:56 +0200 Subject: [PATCH] Fixed incorrect normalization --- src/transformers/image_processing_utils_fast.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/image_processing_utils_fast.py b/src/transformers/image_processing_utils_fast.py index 9998ad60fd5b..73ccd3afba8b 100644 --- a/src/transformers/image_processing_utils_fast.py +++ b/src/transformers/image_processing_utils_fast.py @@ -304,9 +304,9 @@ def compile_friendly_resize( A wrapper around `F.resize` so that it is compatible with torch.compile when the image is a uint8 tensor. """ if image.dtype == torch.uint8: - image = image.float() / 256 + image = image.float() / 255 image = F.resize(image, new_size, interpolation=interpolation, antialias=antialias) - image = image * 256 + image = image * 255 image = torch.where(image > 255, 255, image) image = torch.where(image < 0, 0, image) image = image.round().to(torch.uint8)