-
Notifications
You must be signed in to change notification settings - Fork 336
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
feat: Textual Inversion (embeddings) #129
Conversation
@Green-Sky Try to see if the errors are fixed with the last commit I made. You don't necessarily have to use the feature addressed in this PR. |
This is great. |
@FSSRepo finally, the funky neon looking vae artifacts are gone! 🎉 I noticed the vae tiling has the lowres artifacts still. |
from https://civitai.com/models/72437/baddream-unrealisticdream-negative-embeddings
|
@diimdeep As mentioned in the description, excessively large embeddings are not supported. I don't know how A1111 or ComfyUI manage very long prompts. They can be truncate, something like splitting the embeddings in half and only including the first half, IDK? |
I think we can take a cue from how sd-webui operates. Upon detecting that a token in the prompt corresponds to a local embedding file, we can replace the token with its embedding rather than explicitly specifying it using |
@FSSRepo @slaren Since the sync AFTER set fixes the issue, i am pretty sure that slow-ish PCIe speeds or similar seem to break it. From what i can find online, it seems the sync needs to happen after the memcpy, since a different stream(?) might already be accessing the data before it is ready. edit: feels like this sync should be after instead of before https://github.com/ggerganov/ggml/blob/fca1caafea7de9fbd7efc733b9818f9cf2da3050/src/ggml-cuda.cu#L9684C41-L9684C41 |
That's probably the cause. I expected
So |
This changes were merged to #131 |
I made a quick implementation to support embeddings. It's not the best way to do it, but when the code is refactored, the handling of embeddings could be improved. In some cases, there are very large embeddings that could consume beyond the available context and could lead to overflow or errors.
You can specify the embedding to use by adding the embedding filename to the prompt (usually negative prompt), separate it with
,
. Like this:NOTE:
EasyNegative
It uses a space of 75 tokens, so there are only 2 tokens left.@leejet Any suggestions to improve this?