-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Wildcard stable diffusion pipeline #900
Wildcard stable diffusion pipeline #900
Conversation
The documentation is not available anymore as the PR was closed or merged. |
return WildcardStableDiffusionOutput(images=image, nsfw_content_detected=has_nsfw_concept, prompts=prompt) | ||
|
||
|
||
# if __name__ == "__main__": |
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.
maybe delete this code? :-)
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.
Hey @shyamsn97,
The PR looks great :-)
One final thing then I'd be more than happy to merge.
To increase the easy-of-use and discover-ability of your pipeline, could you add one line to this table: https://github.com/huggingface/diffusers/tree/main/examples/community#community-examples in your PR
and also add one code example in a new markdown section here: https://github.com/huggingface/diffusers/tree/main/examples/community#example-usages
Also happy to do it for you if you could quickly post one usage example in this PR :-)
I'm no dev so maybe I'm misunderstanding something here but if I'm not - why make a pipeline for this? prompt = replaceWildtags(prompt, "-rutkowski") - and because the first char is '-' the result should be anything that does not have "rutkowski" unless no such string exists. This ofc would affect all wildtags - not just artists - but there are easy solutions for that too. Feel free to ignore this - I'm probably the one misunderstanding here. |
Hey @GreenLandisaLie, No, this makes total sense! If you prefer just adding a function yourself before the pipeline that's great :-) For people that would like to have everything in one place such a community pipeline could still be useful. |
Makes sense actually. I did notice a bunch of pipelines (through your link) that I wasn't even aware of and came to that realization soon after posting that comment. Decided to leave it there because the ability to force include/exclude certain strings might be a useful addition to this. |
…sn97/diffusers into wildcard-stable-diffusion-pipeline
Fixed the README but may have done some weird merge shenanigans accidentally, let me know if this pr still works @patrickvonplaten. Otherwise I can just close this and upload a new one :) |
…wildcard-stable-diffusion-pipeline
Fixed it ;-) Pulling the |
Thanks a lot for the contribution - looks very nice! |
Wildcard Stable Diffusion pipeline
Part of #872 and bigger story #841
Following the great examples from https://github.com/jtkelm2/stable-diffusion-webui-1/blob/master/scripts/wildcards.py and https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts#wildcards, here's a minimal implementation that allows for users to add "wildcards", denoted by
__wildcard__
to prompts that are used as placeholders for randomly sampled values given by either a dictionary or a.txt
file. For example:Say we have a prompt:
We can then define possible values to be sampled for
animal
,object
, andclothing
. These can either be from a.txt
with the same name as the category, exanimal.txt
, with contents like:The possible values can also be defined / combined by using a dictionary like:
{"animal":["dog", "cat", mouse"]}
.The actual pipeline works just like
StableDiffusionPipeline
, except the__call__
method takes in:wildcard_files
: list of file paths for wild card replacementwildcard_option_dict
: dict with key aswildcard
and values as a list of possible replacementsnum_prompt_samples
: number of prompts to sample, uniformly sampling wildcardsA full example:
Will need to add some additional documentation, but adding this as a start. Hopefully the implementation is straightforward and easy to understand, and let me know your thoughts on how I can improve this 😄