-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
add sdxl to prompt weighting #4439
Conversation
@stevhliu in a follow-up PR we should make expand the docs here a bit to show more important / interesting use cases as shown here: https://github.com/damian0815/compel/blob/main/doc/syntax.md |
The documentation is not available anymore as the PR was closed or merged. |
Let's first make sure we have the newest version of compel installed: | ||
|
||
``` | ||
pip install --upgrade compel | ||
``` | ||
|
||
Now we can run an example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should go before the StableDiffusionPipeline
example as repeating it becomes kind of redundant.
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", variant="fp16", use_safetensors=True, torch_dtype=torch.float16).to("cuda") | ||
|
||
compel = Compel(tokenizer=[pipeline.tokenizer, pipeline.tokenizer_2] , text_encoder=[pipeline.text_encoder, pipeline.text_encoder_2], returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED, requires_pooled=[False, True]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we indent it please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, let's leave a link to what ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED
means otherwise it might get confusing for the readers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool! 👍
|
||
Let's have a look at the result. | ||
|
||
**Image 1**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd look nicer to compare the images side-by-side (you can copy the code here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
* add sdxl to prompt weighting * Update docs/source/en/using-diffusers/weighted_prompts.md * Update docs/source/en/using-diffusers/weighted_prompts.md * add sdxl to prompt weighting * Apply suggestions from code review Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * Apply suggestions from code review * Update docs/source/en/using-diffusers/weighted_prompts.md * Apply suggestions from code review * correct --------- Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
What does this PR do?
Since 2.0.1 the compel library supports SDXL - this PR updates the docs to give the user a nice example.
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.