diff --git a/scripts/txt2img.py b/scripts/txt2img.py index 59c16a1db..2c0dd65d8 100644 --- a/scripts/txt2img.py +++ b/scripts/txt2img.py @@ -104,6 +104,13 @@ def main(): default="a painting of a virus monster playing guitar", help="the prompt to render" ) + parser.add_argument( + "--negative_prompt", + type=str, + nargs="?", + default="", + help="the negative prompt to render" + ) parser.add_argument( "--outdir", type=str, @@ -286,8 +293,9 @@ def main(): for n in trange(opt.n_iter, desc="Sampling"): for prompts in tqdm(data, desc="data"): uc = None - if opt.scale != 1.0: - uc = model.get_learned_conditioning(batch_size * [""]) + if len(opt.negative_prompt) > 1: + uc = model.get_learned_conditioning( + len(prompts) * [opt.negative_prompt]) if isinstance(prompts, tuple): prompts = list(prompts) c = model.get_learned_conditioning(prompts)