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.
maybe delete this code? :-)
patrickvonplaten
left a comment
There was a problem hiding this comment.
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.txtfile. 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.txtwith 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 aswildcardand 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 😄