Closed Maelstrom2014 closed 2 years ago
there is no such functionality
Thanks for your reply! Could you say something about if this feature has a chance to be implemented and when?
I was going to ask the same question actually. I am surprised this is not in by default since the original Stable Diffusion has the ability to read prompts from a text file.
added a script in latest version to do prompts from file, via the scripts section at the bottom
This is very handy, but can there be a way to not use the same seed on every image?
Can you please show an example how the prompts in the text file need to be layed out? It's unfortunately not obvious at all. Thank you.
use it in the list of "scripts"
чт, 29 дек. 2022 г. в 00:02, Testertime @.***>:
Can you please show an example how the prompts in the text file need to be layed out? It's unfortunately not obvious at all. Thank you.
— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/248#issuecomment-1366914122, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNWDT2G5TRVUGZTJ3WVMCTWPSTHVANCNFSM6AAAAAAQJPUSUY . You are receiving this because you authored the thread.Message ID: @.***>
use it in the list of "scripts"
Yes, but I mean in what syntax I can write prompts into a text file. For example, how do I specify negative prompts in the text file? Stuff like CFG 8.5, Euler_A, seed + seed variation, etc.? Currently it only seems to take words as positive prompts, and that's it. Unless I'm missing something, because the script itself has lines like:
"sampler_name": process_string_tag, "batch_size": process_int_tag, "n_iter": process_int_tag,
and that is why I'm asking. It would be appreciated if you can give an example how to use these in a text file. Thank you in advance for clarifying with this. PS: People in Youtube comments are confused about it too.
Thank you for the forthcoming responses. Here is how to do it:
First, check out the script itself. You see these parameters:
"sd_model": None,
"outpath_samples": process_string_tag,
"outpath_grids": process_string_tag,
"prompt_for_display": process_string_tag,
"prompt": process_string_tag,
"negative_prompt": process_string_tag,
"styles": process_string_tag,
"seed": process_int_tag,
"subseed_strength": process_float_tag,
"subseed": process_int_tag,
"seed_resize_from_h": process_int_tag,
"seed_resize_from_w": process_int_tag,
"sampler_index": process_int_tag,
"sampler_name": process_string_tag,
"batch_size": process_int_tag,
"n_iter": process_int_tag,
"steps": process_int_tag,
"cfg_scale": process_float_tag,
"width": process_int_tag,
"height": process_int_tag,
"restore_faces": process_boolean_tag,
"tiling": process_boolean_tag,
"do_not_save_samples": process_boolean_tag,
"do_not_save_grid": process_boolean_tag
Based on that, you can construct a prompt (and multiple ones!) with commandline arguments and have all the variations you want. An example:
--prompt "A happy Khajiit resting in a bed" --negative_prompt "deformed, ugly, creepy, mutation" --steps 10 --cfg_scale 9.5 --sampler_name "DDIM" --seed 347520046 --width 512 --height 512
Notice in the code the variables withprocess_string_tag
. They have to be enclosed in " "
. You can add more of these prompt tags, just be sure to follow the syntax as shown above. For example, sampler names are recognized as string, so you can type in the literal name from the web UI (e.g. "DPM++ SDE Karras").
For each prompt, make a new line and copy/paste another command argument block like that. Good to know: You can hit enter two times, the script does not mind. So text files or inserted command blocks don't have to look squeezed together. And just to clarify, you can also paste these command blocks into the web UI text field beneath the "scripts" dropdown list. It does not have to be a file.
An example with two prompts in one go, where one prompt has a random seed and the other a fixed one:
--prompt "A happy Khajiit resting in a bed" --negative_prompt "deformed, ugly, creepy, mutation" --steps 10 --cfg_scale 9.5 --sampler_name "DDIM" --seed 347520046 --width 512 --height 512
--prompt "A happy Khajiit resting in a bed" --negative_prompt "deformed, ugly, creepy, mutation" --steps 10 --cfg_scale 8 --sampler_name "Euler A" --seed -1 --width 512 --height 512
In theory, when you have a program that can construct varieties of your prompts (does that exist?), you do not need to specify batch size. You can then copy/paste blocks with your own variations.
Thank you for making this helpful script. Please consider making a short explanation as a code comment next time.
This is awesome, thanks for posting it. There's one thing I need that I don't see here though: Highres fix. Is there a way to do that?
Oh, also not seeing Denoising Strength. Is that what subseed_strength is?
Is the "--sd_model"
option still supposed to work?
Whenever I try it I get an "AssertionError: unknown commandline option: --sd_model"
error.
Sample prompt: --prompt "dog, sofa, photograph" --batch_size 5 --sd_model "ProtoGen_X3.4.ckpt"
Same here. Trying to specify the model that way doesn't work for me either, and I get the same error.
Looks like the function that should apply the model was never implemented. Or maybe it worked at some point?
Oh, also not seeing Denoising Strength. Is that what subseed_strength is?
Looking at the code briefly, the script feeds the p
structure to Processed
, which comes from modules/processing.py
. The denoising_strength
setting is supported there (see its __init__
), but the interface to feed in that info is missing from the prompt_tags
dict in scripts/prompts_from_file.py
.
This suggests adding an entry "denoising_strength": process_float_tag,
to that dict should help. Haven't tested, though.
Looks like the function that should apply the model was never implemented. Or maybe it worked at some point?
No idea about sd_model
- would be very useful to have, but the initialization for that isn't as straightforward. I suppose that's why the function wasn't implemented.
And thanks for the info, everyone! This is highly useful for generating regularization images for training LoRAs.
An example with two prompts in one go, where one prompt has a random seed and the other a fixed one:
--prompt "A happy Khajiit resting in a bed" --negative_prompt "deformed, ugly, creepy, mutation" --steps 10 --cfg_scale 9.5 --sampler_name "DDIM" --seed 347520046 --width 512 --height 512
how to add clip skip, i try --clip_skip but it didn't work
The model would be great maybe could be used with Agent Scheduler, I am trying to find a way to automate testing of previous generations against multiple new models
@latuyenliet
Just like denoising_strength
, it seems the Processed
class supports clip_skip
, but the interface to feed it in from this script is missing.
Possible solution: modify scripts/prompts_from_file.py
. Add the entry "clip_skip": process_int_tag
to the prompt_tags
dict.
In other words, with both denoising_strength
and clip_skip
added, the dict should look like this:
prompt_tags = {
"sd_model": None,
"outpath_samples": process_string_tag,
"outpath_grids": process_string_tag,
"prompt_for_display": process_string_tag,
"prompt": process_string_tag,
"negative_prompt": process_string_tag,
"styles": process_string_tag,
"seed": process_int_tag,
"subseed_strength": process_float_tag,
"subseed": process_int_tag,
"seed_resize_from_h": process_int_tag,
"seed_resize_from_w": process_int_tag,
"sampler_index": process_int_tag,
"sampler_name": process_string_tag,
"batch_size": process_int_tag,
"n_iter": process_int_tag,
"steps": process_int_tag,
"cfg_scale": process_float_tag,
"width": process_int_tag,
"height": process_int_tag,
"restore_faces": process_boolean_tag,
"tiling": process_boolean_tag,
"do_not_save_samples": process_boolean_tag,
"do_not_save_grid": process_boolean_tag,
"denoising_strength": process_float_tag, # <-- add this line
"clip_skip": process_int_tag # <-- add this line
}
@latuyenliet
Just like
denoising_strength
, it seems theProcessed
class supportsclip_skip
, but the interface to feed it in from this script is missing.Possible solution: modify
scripts/prompts_from_file.py
. Add the entry"clip_skip": process_int_tag
to theprompt_tags
dict.In other words, with both
denoising_strength
andclip_skip
added, the dict should look like this:prompt_tags = { "sd_model": None, "outpath_samples": process_string_tag, "outpath_grids": process_string_tag, "prompt_for_display": process_string_tag, "prompt": process_string_tag, "negative_prompt": process_string_tag, "styles": process_string_tag, "seed": process_int_tag, "subseed_strength": process_float_tag, "subseed": process_int_tag, "seed_resize_from_h": process_int_tag, "seed_resize_from_w": process_int_tag, "sampler_index": process_int_tag, "sampler_name": process_string_tag, "batch_size": process_int_tag, "n_iter": process_int_tag, "steps": process_int_tag, "cfg_scale": process_float_tag, "width": process_int_tag, "height": process_int_tag, "restore_faces": process_boolean_tag, "tiling": process_boolean_tag, "do_not_save_samples": process_boolean_tag, "do_not_save_grid": process_boolean_tag, "denoising_strength": process_float_tag, # <-- add this line "clip_skip": process_int_tag # <-- add this line }
thank you, bro
Did adding them work? I assume we could maybe also add ENSD for example 1 or 31337?
In response to the feature request, I have added a feature called copy as single line prompt to the SD Prompt Reader 1.3.2. Now you can copy prompt in "prompts from files or text box" format.
The following parameters are supported: Setting | Parameter |
---|---|
Seed | --seed |
Variation seed strength | --subseed_strength |
Seed resize from | --seed_resize_from_h |
Seed resize from | --seed_resize_from_w |
Sampler | --sampler_name |
Steps | --steps |
CFG scale | --cfg_scale |
Size | --width |
Size | --height |
Face restoration | --restore_faces |
May be I miss something, please point me how to load Prompts from file in Colab Version?