mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
fix prompt parser with batch size
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -53,7 +53,8 @@ class PromptEmbedder:
|
||||
self.negative_prompts = negative_prompts
|
||||
self.batchsize = len(self.prompts)
|
||||
self.attention = last_attention
|
||||
self.allsame = self.compare_prompts() # collapses batched prompts to single prompt if possible
|
||||
self.allsame = False # dont collapse prompts
|
||||
# self.allsame = self.compare_prompts() # collapses batched prompts to single prompt if possible
|
||||
self.steps = steps
|
||||
self.clip_skip = clip_skip
|
||||
# All embeds are nested lists, outer list batch length, inner schedule length
|
||||
@@ -83,7 +84,7 @@ class PromptEmbedder:
|
||||
self.checkcache(p)
|
||||
debug(f"Prompt encode: time={(time.time() - t0):.3f}")
|
||||
|
||||
def checkcache(self, p):
|
||||
def checkcache(self, p) -> bool:
|
||||
if shared.opts.sd_textencoder_cache_size == 0:
|
||||
return False
|
||||
if self.scheduled_prompt:
|
||||
@@ -176,13 +177,13 @@ class PromptEmbedder:
|
||||
else:
|
||||
prompt_embed, positive_pooled, negative_embed, negative_pooled = get_weighted_text_embeddings(pipe, positive_prompt, negative_prompt, self.clip_skip)
|
||||
if prompt_embed is not None:
|
||||
self.prompt_embeds[batchidx].append(prompt_embed)
|
||||
self.prompt_embeds[batchidx] = [prompt_embed]
|
||||
if negative_embed is not None:
|
||||
self.negative_prompt_embeds[batchidx].append(negative_embed)
|
||||
self.negative_prompt_embeds[batchidx] = [negative_embed]
|
||||
if positive_pooled is not None:
|
||||
self.positive_pooleds[batchidx].append(positive_pooled)
|
||||
self.positive_pooleds[batchidx] = [positive_pooled]
|
||||
if negative_pooled is not None:
|
||||
self.negative_pooleds[batchidx].append(negative_pooled)
|
||||
self.negative_pooleds[batchidx] = [negative_pooled]
|
||||
|
||||
if debug_enabled:
|
||||
get_tokens(pipe, 'positive', positive_prompt)
|
||||
|
||||
Reference in New Issue
Block a user