From ce673f29cee4903fb2b07c066866bc9159a1d85c Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Thu, 21 Mar 2024 20:47:08 -0700 Subject: [PATCH] Fix and re-enable `imagegen_test.go` (1/2: Fix.) PIL requires a string format name, whereas `Format.PNG` is an "enum string" which is not quite the same type. I had not noticed this problem because I had manually tested the test on a VM where the cached Stable Diffusion XL Docker image was from before this change. Tested on a fresh VM with a freshly-built Docker image now. This is split in two changes because the image needs to be rebuilt. The first change updates the image, and the second change re-enables the test. PiperOrigin-RevId: 618048266 --- images/gpu/stable-diffusion-xl/generate_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/gpu/stable-diffusion-xl/generate_image.py b/images/gpu/stable-diffusion-xl/generate_image.py index 3dbd61c0c..723849fdd 100644 --- a/images/gpu/stable-diffusion-xl/generate_image.py +++ b/images/gpu/stable-diffusion-xl/generate_image.py @@ -241,7 +241,7 @@ if args.format in (Format.PNG, Format.JPEG): image.save(args.out, args.format) else: buf = io.BytesIO() - image.save(buf, format=Format.PNG) + image.save(buf, format=Format.PNG.value) image_bytes = buf.getvalue() time_done = datetime.datetime.now(datetime.timezone.utc) with open(args.out, 'wb') as f: