Blank images when using MPS

#1
by Vargol - opened

Hi using the following script I'm getting blank images and the error message

/Volumes/SSD2TB/AI/Diffusers/lib/python3.10/site-packages/diffusers/image_processor.py:111: RuntimeWarning: invalid value encountered in cast
  images = (images * 255).round().astype("uint8")

When running inference on an Apple iMac using MPS.
Versions 1.0 and 1.0 worked without issue, and still work with the more recent diffusers install from source (taken around lunch time 4th July in the
UK)

I've also tried it with the fp16 fixed vae, but that made no difference. Here's the script I used for testing, note the version I've pasted still loads the madebyollin vae, but doesn't use it, I originally tried without any mention of the fp16 fixed vae.

import torch
from diffusers import HunyuanDiTPipeline, AutoencoderKL

vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix",
                                    torch_dtype=torch.float16,
                                    ).to('mps')


prompt = "A man walking over a pit of doritos"

pipe = HunyuanDiTPipeline.from_pretrained(
    "Tencent-Hunyuan/HunyuanDiT-v1.2-Diffusers", torch_dtype=torch.float16,
     #vae=vae
)
pipe.to("mps")

# You may also use English prompt as HunyuanDiT supports both English and Chinese
prompt = "An astronaut riding a horse"

image = pipe(prompt).images[0]
image.save('dit2.png')

have you solved this problem?

Sign up or log in to comment