AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.7k stars 26.48k forks source link

[Bug]: Runtime Error Mat 1 and Mat2 must have the same dtype. #8084

Open dumdum1066 opened 1 year ago

dumdum1066 commented 1 year ago

Is there an existing issue for this?

What happened?

Trying test images after install Web-UI, i.e., "large dog", and getting no result and the error message "Runtime Error Mat 1 and Mat2 must have the same dtype." Install was clean and UI loads fine; haven't tweaked or adjusted any settings on Web-UI or Python, just trying to run as installed. Tried on both 1.5 and 2.0 models, same result. Is there a setting to adjust somewhere or a file to edit? Running on NVIDIA 2070 Super.

Python is 3.10.10, Torch is 1.13.1+cu17 Xformers n/a Checkpoint: e141589a6

Steps to reproduce the problem

Trying test images after install Web-UI, i.e., "large dog", and getting no result and the error message "Runtime Error Mat 1 and Mat2 must have the same dtype." Install was clean and UI loads fine; haven't tweaked or adjusted any settings on Web-UI or Python, just trying to run as installed. Tried on both 1.5 and 2.0 models, same result. Is there a setting to adjust somewhere or a file to edit? Running on NVIDIA 2070 Super.

Python is 3.10.10, Torch is 1.13.1+cu17 Xformers n/a Checkpoint: e141589a6

What should have happened?

Presumably, an image should have generated.

Commit where the problem happens

0cc0EE1b

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--precision full --no-half-vae

List of extensions

None

Console logs

Runtime Error Mat 1 and Mat2 must have the same dtype.

Additional information

No response

Loak-The-Blue commented 1 year ago

I have the same issue and launching stable diffusion with launch.py (instead of webui-user) resolved this problem.

flaa2000 commented 1 year ago

I'm having the same problem atm. After updating webui-user does not work atm. Only launch.py works and I can only use model v1-5 when using launch.py. No idea what to do.

tekakutli commented 1 year ago

I was having that issue, and I fixed it by using --precision full --no-half

iniastic commented 1 year ago

I was having that issue, and I fixed it by using --precision full --no-half

thanks this fixed it for me

JohnTesla commented 1 year ago

I've got this problem after Deforum Try to get back

kopyl commented 10 months ago

What helped for me:

i had a Diffusers pipeline like this:

unet = UNet2DConditionModel.from_pretrained(
    "/workspace/unet",
    use_safetensors=True,
).to("cuda")
vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
).to("cuda")
pipeline = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    unet=unet,
    torch_dtype=torch.float16,
).to("cuda")

But when i added torch_dtype to all of the pipeline's elements the error has gone and i started generating images. I had to have it like this:

unet = UNet2DConditionModel.from_pretrained(
    "/workspace/unet",
    use_safetensors=True,
    torch_dtype=torch.float16
).to("cuda")
vae = AutoencoderKL.from_pretrained(
    "madebyollin/sdxl-vae-fp16-fix",
    torch_dtype=torch.float16
).to("cuda")
pipeline = StableDiffusionXLPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    vae=vae,
    unet=unet,
    torch_dtype=torch.float16,
).to("cuda")

^ The only thing that changed was adding torch_dtype=torch.float16 to AutoencoderKL and UNet2DConditionModel

frank-wirth commented 7 months ago

i changed --no-half-vae to --no--half. fixed. thx

frank-wirth commented 7 months ago

..to --no-half

ninjacharly commented 3 months ago

I was having that issue, and I fixed it by using --precision full --no-half

Where do you use it? I'm not a programmer but a designer trying to make Ai images and I got this Error.

Thank you in advanced!

hsm207 commented 3 months ago

Where do you use it?

It's a command line argument. This doc has all the details on how to set it up.

Fangsturm commented 1 month ago

I was having that issue, and I fixed it by using --precision full --no-half

Had the same problem with LDSR, always threw that error. Your solution was very helpful, I can upscale with LDSR now.

THANKS!!!

Fangsturm commented 1 month ago

I was having that issue, and I fixed it by using --precision full --no-half

Where do you use it? I'm not a programmer but a designer trying to make Ai images and I got this Error.

Thank you in advanced!

You have to edit the 'webui-user.bat', it's a file in your 'stable-diffusion-webui'-folder. There you find a row 'set COMMANDLINE_ARGS=', and there, after '=' you have to add '--precision full --no-half'. It should look like 'set COMMANDLINE_ARGS=--precision full --no-half'. Save the file and start A1111.