stable-diffusion.cpp icon indicating copy to clipboard operation
stable-diffusion.cpp copied to clipboard

add support for load textual inversion embeddings

Open zhaojinzhou opened this issue 1 year ago • 7 comments

hope to support embeddings format end with .pt

zhaojinzhou avatar Aug 08 '24 03:08 zhaojinzhou

It already supports embeddings. You can call them with:

./sd ....  --embd-dir embedding_dir -p "prompt, embedding:embeddingname"

daniandtheweb avatar Aug 09 '24 11:08 daniandtheweb

It already supports embeddings. You can call them with:

./sd ....  --embd-dir embedding_dir -p "prompt, embedding:embeddingname"

but when I use badhand_v4.pt, It throws exception, and log error info : using checkpoint format It dost not work.

zhaojinzhou avatar Aug 12 '24 08:08 zhaojinzhou

It already supports embeddings. You can call them with:

./sd ....  --embd-dir embedding_dir -p "prompt, embedding:embeddingname"

5b98e7a1d21629738f537746530fc090672502e7_knock_capture_image

zhaojinzhou avatar Aug 12 '24 09:08 zhaojinzhou

Can you send your full launch code and / or log?

daniandtheweb avatar Aug 12 '24 10:08 daniandtheweb

Can you send your full launch code and / or log?

[INFO ] stable-diffusion.cpp:501 - loading model from 'bWFqaWN2Ni5zYWZldGVuc29ycwo=' completed, taking 0.42s [INFO ] stable-diffusion.cpp:528 - running in eps-prediction mode [INFO ] stable-diffusion.cpp:655 - Attempting to apply 0 LoRAs [INFO ] stable-diffusion.cpp:1132 - apply_loras completed, taking 0.00s [INFO ] model.cpp:796 - load embeddings/FastNegativeV2.pt using checkpoint format /root/stable-diffusion.cpp/ggml/src/ggml-cuda/concat.cu:157: GGML_ASSERT(src0->type == GGML_TYPE_F32) failed Aborted (core dumped) root@bc413b608e61:~# ls embeddings/ FastNegativeV2.pt bad-picture-chill-75v.pt badhandv4.pt ng_deepnegative_v1_75t.pt root@bc413b608e61:~# ./trainer_cpp -m bWFqaWN2Ni5zYWZldGVuc29ycwo= -p 'sexy girl 20_years_old' -n 'bad hands, FastNegativeV2' --steps 20 --embd-dir embeddings

aa5c501e1c909ad6e73ccac032c25e3584b4a7d7_knock_capture_image

zhaojinzhou avatar Sep 04 '24 09:09 zhaojinzhou

Can you send your full launch code and / or log?

[INFO ] stable-diffusion.cpp:501 - loading model from 'bWFqaWN2Ni5zYWZldGVuc29ycwo=' completed, taking 0.42s [INFO ] stable-diffusion.cpp:528 - running in eps-prediction mode [INFO ] stable-diffusion.cpp:655 - Attempting to apply 0 LoRAs [INFO ] stable-diffusion.cpp:1132 - apply_loras completed, taking 0.00s [INFO ] model.cpp:796 - load embeddings/FastNegativeV2.pt using checkpoint format /root/stable-diffusion.cpp/ggml/src/ggml-cuda/concat.cu:157: GGML_ASSERT(src0->type == GGML_TYPE_F32) failed Aborted (core dumped) root@bc413b608e61:~# ls embeddings/ FastNegativeV2.pt bad-picture-chill-75v.pt badhandv4.pt ng_deepnegative_v1_75t.pt root@bc413b608e61:~# ./trainer_cpp -m bWFqaWN2Ni5zYWZldGVuc29ycwo= -p 'sexy girl 20_years_old' -n 'bad hands, FastNegativeV2' --steps 20 --embd-dir embeddings

aa5c501e1c909ad6e73ccac032c25e3584b4a7d7_knock_capture_image

cublas version

zhaojinzhou avatar Sep 04 '24 09:09 zhaojinzhou

I've been using the vulkan version before and there it worked but I'm now on the cublas version and you're right, there this fails. Apparently the needed operations to handle the embeddings still haven't been added.

However the issue isn't about the .pt format, I think it's about embeddings in general as also easynegative.safetensors doesn't work. I haven't been able to use any embedding for now on cublas.

daniandtheweb avatar Sep 28 '24 15:09 daniandtheweb