RuntimeError: expected scalar type BFloat16 but found Float #42

by Ringerill - opened

Hello,

As the title states, I'm running into this error when trying to generate images with the default parameters using a CPU on Mac.

Setting --precision to be 'full' seems to help.

We will merge a PR that makes sure SD can be run on Mac tomorrow: https://github.com/huggingface/diffusers/pull/355

Setting --precision to be 'full' seems to help.

@aduranel , I think we do not launch the jobs in the same way so I'm a little bit lost as to where this argument should be called.
Would you mind indicating what function actually allows this?

Hmm. In txt2img.py, around line 238, there is a block like this:

parser.add_argument(
"--precision",
type=str,
help="evaluate at this precision",
choices=["full", "autocast"],
default="autocast"
)

Changing the default to "full" helped me when I encountered this error.

@aduranel Ok now I am very confused and probably I'm not even doing it right...
I've been using the StableDiffusionPipeline function from diffusers as shown in the example.
I though that at some point the Stable diffusion functions were called in the background but am I simply mistaken and not even in the good repo here?

Sorry, I've been trying different repo for the whole day to make it work on Mac and I might have mixed some things...

Possibly you use autocast("cuda") when working with cpu? Then it should be autocast("cpu") (and I think you can only use 32bit floats on the cpu).

Setting --precision to be 'full' seems to help.

this worked for me. thanks!