replicate/latent-consistency-model

model.to('mps') or ('mps:0') produces wrong results

RELNO opened this issue · 0 comments

RELNO commented

On Apple M1 (latest diffusers etc) following this tutorial:
https://raw.githubusercontent.com/replicate/latent-consistency-model/main/main.py

when creating pipe:

pipe = DiffusionPipeline.from_pretrained("SimianLuo/LCM_Dreamshaper_v7")
pipe.to(torch_dtype=torch.float32).to('mps:0')

a fast inference results with:
bd0022c1-0b80-4954-b832-709b37fda109

however this pipe:

pipe = DiffusionPipeline.from_pretrained("SimianLuo/LCM_Dreamshaper_v7")
pipe.to(torch_dtype=torch.float32)

is slower but works:
496a6e86-4919-4ead-957f-d128876d295a

Full code for reference:

from diffusers import DiffusionPipeline
import torch

pipe = DiffusionPipeline.from_pretrained("SimianLuo/LCM_Dreamshaper_v7")
pipe.to(torch_dtype=torch.float32) # <--- .to('mps:0') goes here 

prompt = "a beautiful apple floating in outer space, like a planet"
images = pipe(
    prompt=prompt,
    num_inference_steps=4,
    guidance_scale=8,
    lcm_origin_steps=50,
    num_images_per_prompt=1,
    width=512,
    height=512,
    
).images[0]

images