From a05aaee7739aeb65456a336db9e24763a918fdd4 Mon Sep 17 00:00:00 2001 From: Pierre Colle Date: Mon, 15 Jan 2024 23:02:50 +0100 Subject: [PATCH] feat: P mode in image --- src/refiners/fluxion/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/refiners/fluxion/utils.py b/src/refiners/fluxion/utils.py index 47789a2eb..0efe971ef 100644 --- a/src/refiners/fluxion/utils.py +++ b/src/refiners/fluxion/utils.py @@ -121,6 +121,9 @@ def image_to_tensor(image: Image.Image, device: Device | str | None = None, dtyp Values are clamped to the range `[0, 1]`. """ + if image.mode == 'P': + image = image.convert('RGB') + image_tensor = torch.tensor(array(image).astype(float32) / 255.0, device=device, dtype=dtype) match image.mode: