lora icon indicating copy to clipboard operation
lora copied to clipboard

RuntimeError: "addmm_impl_cpu_" not implemented for 'Half'

Open riccardobl opened this issue 2 years ago • 5 comments

Hello. I am new in all this and i am not even sure if this is a bug or expected behavior... but I am getting this error "RuntimeError: "addmm_impl_cpu_" not implemented for 'Half'" in

lora_diffusion/lora.py", line 348, in weight_apply_lora
    weight = weight + alpha * (up_weight @ down_weight).type(weight.dtype)

when merging the lora weight with runwayml/stable-diffusion-v1-5 on branch fp16 with mode upl-ckpt-v2 , it works fine on branch main (i assume because it doesn't use half floats?)

riccardobl avatar Dec 28 '22 22:12 riccardobl

Hi, is your target unet on CUDA device?

cloneofsimo avatar Dec 29 '22 04:12 cloneofsimo

I'll have a look, thank you for the issue!

cloneofsimo avatar Dec 29 '22 07:12 cloneofsimo

Hi, is your target unet on CUDA device?

Sorry, i forgot to mention, i am using the lora_add cli and the issue is from this line here

https://github.com/cloneofsimo/lora/blob/c3bf2e46e74066318f283a1f709bd8b4c75b4720/lora_diffusion/cli_lora_add.py#L96

so i think, yes, the target is unet but on cpu

riccardobl avatar Dec 29 '22 09:12 riccardobl

Ok, I think you would require them on GPU to get it work. At least I've tested them on GPUs only.

cloneofsimo avatar Dec 29 '22 14:12 cloneofsimo

I get it to run by changing line 94 of cli_lora_add.py from ).to("cpu") to ).("cuda")

hdon96 avatar Jan 06 '23 01:01 hdon96