Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run PhotoMaker. #411

Open
aalok013 opened this issue Sep 15, 2024 · 4 comments
Open

Unable to run PhotoMaker. #411

aalok013 opened this issue Sep 15, 2024 · 4 comments

Comments

@aalok013
Copy link

I'm unable to run photomaker as it is unable to find input image. I'm using bellow command. And I'm using gguf model as safetensors model of photomaker is giving me another error GGML_ASSERT(ggml_nelements(a) == ggml_nelements(b)) failed

./sd\sd.exe -M txt2img -m ./models/Stable-Diffusion/juggernaut_reborn.safetensors -p "a guy img" --sampling-method euler_a --steps 20 --schedule discrete -W 384 -H 384 -b 1 --cfg-scale 7 -s -1 --clip-skip 1 --embd-dir ./models/Embeddings/ --lora-model-dir ./models/Lora/ -t 0 --rng cuda -o ./output/txt2img/39_photo.png --vae-on-cpu --color --stacked-id-embd-dir ./models/PhotoMaker/photomaker-v1.q8_0.gguf --input-id-images-dir ./mage.jpg --normalize-input

I see the following log in console. And I tried using image without extension as shown in the guide as well. But it's not working either.

[WARN ] stable-diffusion.cpp:1200 - Provided PhotoMaker model file, but NO input ID images
[WARN ] stable-diffusion.cpp:1201 - Turn off PhotoMaker
@bssrdf
Copy link
Contributor

bssrdf commented Sep 16, 2024

-input-id-images-dir expects a directory which contains input images. Try
--input-id-images-dir ./ in the command line.

BTW, can you point me to the safetensor version of the photomaker model file that gave the error?

@aalok013
Copy link
Author

I tired changing it to relative path. It's seems to identify the image now. But it's throwing the error.

Command:
./sd\sd.exe -M txt2img -m ./models/Stable-Diffusion/juggernaut_reborn.safetensors -p "a girl img" --sampling-method euler_a --steps 20 --schedule discrete -W 384 -H 384 -b 1 --cfg-scale 7 -s -1 --clip-skip 1 --embd-dir ./models/Embeddings/ --lora-model-dir ./models/Lora/ -t 0 --rng cuda -o F:\SD\sd-cpp-output/txt2img/39_photo.png --vae-on-cpu --color --stacked-id-embd-dir ./models/PhotoMaker/photomaker-v1.q8_0.gguf --input-id-images-dir ./models/PhotoMaker/image --normalize-input

Error:
D:\a\stable-diffusion.cpp\stable-diffusion.cpp\ggml\src\ggml.c:4702: GGML_ASSERT(ggml_can_repeat(b, a)) failed

And I tired using the original safetensors file as well. But that's giving another error.

D:\a\stable-diffusion.cpp\stable-diffusion.cpp\ggml\src\ggml.c:5792: GGML_ASSERT(ggml_nelements(a) == ggml_nelements(b)) failed

But this error is different from previous error I got when using safetensors file. It seems there is some problem when I'm using absolute path for photomaker.

I downloaded the model mentioned in the guide. Here is the url

@aalok013
Copy link
Author

I found the issue. It seems the problem is the model. I'm using 1.5 and I have to use SDXL. Although the results are not great, I'm able to run it now.
But we still have an issue when using absolute path instead of relative path for PhotoMaker.

Thanks for the help.

@bssrdf
Copy link
Contributor

bssrdf commented Sep 17, 2024

There maybe a bug in win32 portion of the code to get files from an absolute directory. The Photomaker V1 implementation in SD does not produce high ID fidelity. There is a PR pending which updated to V2. The fidelity improves a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants