Skip to content

Prompt variation generation, descriptive filenames, flags to disable filters#233

Open
StuartRiffle wants to merge 1 commit intoCompVis:mainfrom
StuartRiffle:main
Open

Prompt variation generation, descriptive filenames, flags to disable filters#233
StuartRiffle wants to merge 1 commit intoCompVis:mainfrom
StuartRiffle:main

Conversation

@StuartRiffle
Copy link
Copy Markdown

@StuartRiffle StuartRiffle commented Sep 8, 2022

(1) I added an option --generate_prompts, which lets you use curly braces to generate variations of a prompt, so that they can all be processed in one run without reloading the model, as if they were supplied in a text file.

The prompt "A {red, really big blue, } {dog, cat}" will generate six outputs:

- A red dog
- A red cat
- A really big blue dog
- A really big blue cat
- A dog
- A cat

Note that the first set of curly braces has an empty entry at the end, which is replaced by nothing in the prompt.

This is good for trying different combinations of magic style words at the end of your prompt ("35mm", "oil painting", etc). I will often just type everything I can think of, then let it crunch away in the background while I do other stuff.

(2) I also added some flags to allow for more descriptive filenames for the output images:

  • --prompt_in_name puts the user's prompt (sanitized for illegal characters) into the filename
  • --meta_in_name appends the number of iterations, the seed, and a few other values into the filename
  • --skip_numbering means to not put a five digit index at the start of the filename

For example, the prompt "A red cat" with --prompt_in_name and --meta_in_name, produces something like:

00216 - A red cat (832x832, 200 steps, downsampled x8, scale 7.5, eta 0.0, PLMS, seed 42)

And if you use --skip_numbering you just get:

A red cat (832x832, 200 steps, downsampled x8, scale 7.5, eta 0.0, PLMS, seed 42)

A problem with doing this is that depending on the prompt, the filename can be too long for the filesystem and fail to write. This PR handles that by just falling back to the five digit number, and outputting a warning. This is especially likely to happen if the metadata is also on. Maybe that part should be shorter?

(3) I added command line switches to disable the content filter and the watermark to save GPU memory when processing large batches. This allowed me to bump up my local image resolution a little bit (and also keep surprise rickrolls out of batch output).

  • --skip_safety disables detection and filtering of objectionable content
  • --skip_watermark disables the watermark to flag images as computer generated

(4) The command line option --seed interprets a special seed of zero to mean "random". The batch will start with a random seed, and subsequent images use that seed +1, +2, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants