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