aboutsummaryrefslogtreecommitdiff
path: root/modules/prompt_parser.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-13 11:35:52 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-07-13 11:35:52 +0300
commit594c8e7b263d9b37f4b18b56b159aeb6d1bba1b4 (patch)
tree274143ec746dcc454c3b0b5b094abf688d2da676 /modules/prompt_parser.py
parent21aec6f567f52271efbbe33a2ab6561f9a47b787 (diff)
fix CLIP doing the unneeded normalization
revert SD2.1 back to use the original repo add SDXL's force_zero_embeddings to negative prompt
Diffstat (limited to 'modules/prompt_parser.py')
-rw-r--r--modules/prompt_parser.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/prompt_parser.py b/modules/prompt_parser.py
index 33810669..b29d079d 100644
--- a/modules/prompt_parser.py
+++ b/modules/prompt_parser.py
@@ -116,11 +116,17 @@ class SdConditioning(list):
A list with prompts for stable diffusion's conditioner model.
Can also specify width and height of created image - SDXL needs it.
"""
- def __init__(self, prompts, width=None, height=None):
+ def __init__(self, prompts, is_negative_prompt=False, width=None, height=None, copy_from=None):
super().__init__()
self.extend(prompts)
- self.width = width or getattr(prompts, 'width', None)
- self.height = height or getattr(prompts, 'height', None)
+
+ if copy_from is None:
+ copy_from = prompts
+
+ self.is_negative_prompt = is_negative_prompt or getattr(copy_from, 'is_negative_prompt', False)
+ self.width = width or getattr(copy_from, 'width', None)
+ self.height = height or getattr(copy_from, 'height', None)
+
def get_learned_conditioning(model, prompts: SdConditioning | list[str], steps):
@@ -153,7 +159,7 @@ def get_learned_conditioning(model, prompts: SdConditioning | list[str], steps):
res.append(cached)
continue
- texts = [x[1] for x in prompt_schedule]
+ texts = SdConditioning([x[1] for x in prompt_schedule], copy_from=prompts)
conds = model.get_learned_conditioning(texts)
cond_schedule = []