huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
24.27k stars 5.01k forks source link

Bug of PixArtAlphaPipeline #7798

Open CuddleSabe opened 2 months ago

CuddleSabe commented 2 months ago

Describe the bug

When I use with torch.autocast("cuda"): images = pipe(...)

the output is noise validation_0_fe0c3de4f9a024ad739f

Reproduction

import torch from diffusers import PixArtAlphaPipeline

pipe = PixArtAlphaPipeline.from_pretrained("PixArt-alpha/PixArt-XL-2-1024-MS", torch_dtype=torch.float16) pipe.enable_model_cpu_offload() prompt = "A small cactus with a happy face in the Sahara desert."

with torch.autocast("cuda"): image = pipe(prompt).images[0]

Logs

No response

System Info

master

Who can help?

No response

tolgacangoz commented 2 months ago

It is not recommended to use torch.autocast() when using torch.float16.