Negative prompt support based on @AUTOMATIC1111 Wiki

This commit is contained in:
john whately 2023-09-19 23:16:09 +09:30 committed by GitHub
parent 6196477662
commit cc87568b68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,6 +60,13 @@ def parse_args():
default="a professional photograph of an astronaut riding a triceratops",
help="the prompt to render"
)
parser.add_argument(
"--n_prompt",
type=str,
nargs="?",
default="",
help="the negative prompt to render"
)
parser.add_argument(
"--outdir",
type=str,
@ -309,8 +316,11 @@ def main(opt):
prompts = data[0]
print("Running a forward pass to initialize optimizations")
uc = None
if opt.n_prompt == "":
if opt.scale != 1.0:
uc = model.get_learned_conditioning(batch_size * [""])
else:
uc = model.get_learned_conditioning(opt.n_prompt)
if isinstance(prompts, tuple):
prompts = list(prompts)