mirror of
https://github.com/Stability-AI/stablediffusion.git
synced 2025-01-03 13:18:20 +00:00
Negative prompt support based on @AUTOMATIC1111 Wiki
This commit is contained in:
parent
6196477662
commit
cc87568b68
1 changed files with 12 additions and 2 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue