fix: PhotoMaker: avoid GGML_ASSERT if trigger word was not found in prompt - #1835
Merged
Conversation
…d in prompt Before this little patch: [DEBUG] bpe_tokenizer.cpp:208 - split prompt "man is playing a guitar" to tokens ["man</w>", "is</w>", "playing</w>", "a</w>", "guitar</w>", ] /home/usr/stable-diffusion.cpp/src/extensions/photomaker_extension.cpp:99: GGML_ASSERT(it != tokens.end()) failed ... [Inferior 1 (process 3985) detached] ./0_NEWTON_MAN_FRU: Zeile 11: 3985 Abort (core dumped) ./sd-cli -m ~/SD_models/sdxl/zavychromaxl_v100.safetensors --vae ~/SD_models/sdxl/sdxl_vae.safetensors --clip-on-cpu --steps 20 -v --seed 44 --cfg-scale 5 --photo-maker ~/SD_models/loras_sdxl/photomaker-v1.safetensors --pm-id-images-dir ./assets --pm-style-strength 5 -p "man is playing a guitar" Now: [WARN ] photomaker_extension.cpp:231 - PhotoMaker trigger word 'img' was not found in prompt [WARN ] photomaker_extension.cpp:232 - Turn off PhotoMaker for this request ...and continue here and write output file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently, a missing trigger word ("img") in PhotoMaker's prompt is not handled correctly (see below).
I added an additional check for
class_idx >= 0when creating theclass_token_mask.That leads to this message:
[WARN ] photomaker_extension.cpp:232 - Turn off PhotoMaker for this requestand continuation of the program just like in similar situations (e.g. "Photomaker ID Stacking failed" etc.) .
Related Issue / Discussion
Note:
class_idxstays at initial values of-1if we do not get the trigger word in the loop before.Additional Information
Before this little patch:
Now we have:
Checklist