From 5c8af8f0b4084114b446aaa860b1b919548433db Mon Sep 17 00:00:00 2001 From: yolain Date: Fri, 22 Mar 2024 02:31:43 +0800 Subject: [PATCH] fix:easy pipeEdit should use the pipe steps rather than find near steps #97 --- py/easyNodes.py | 9 ++++++--- py/libs/conditioning.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/py/easyNodes.py b/py/easyNodes.py index d04425e..0dfdd78 100644 --- a/py/easyNodes.py +++ b/py/easyNodes.py @@ -4168,11 +4168,11 @@ class pipeEdit: pipe_lora_stack = pipe.get("lora_stack") if pipe is not None and "lora_stack" in pipe else None + steps = pipe["loader_settings"]["steps"] if "steps" in pipe["loader_settings"] else 1 if pos is None and optional_positive != '': - print(a1111_prompt_style) pos, positive_wildcard_prompt, model, clip = prompt_to_cond('positive', model, clip, clip_skip, pipe_lora_stack, optional_positive, positive_token_normalization,positive_weight_interpretation, - a1111_prompt_style, my_unique_id, prompt, easyCache) + a1111_prompt_style, my_unique_id, prompt, easyCache, True, steps) pos = set_cond(pipe['positive'], pos, conditioning_mode, average_strength, old_cond_start, old_cond_end, new_cond_start, new_cond_end) pipe['loader_settings']['positive'] = positive_wildcard_prompt pipe['loader_settings']['positive_token_normalization'] = positive_token_normalization @@ -4187,7 +4187,7 @@ class pipeEdit: if neg is None and optional_negative != '': neg, negative_wildcard_prompt, model, clip = prompt_to_cond("negative", model, clip, clip_skip, pipe_lora_stack, optional_negative, negative_token_normalization, negative_weight_interpretation, - a1111_prompt_style, my_unique_id, prompt, easyCache) + a1111_prompt_style, my_unique_id, prompt, easyCache, True, steps) neg = set_cond(pipe['negative'], neg, conditioning_mode, average_strength, old_cond_start, old_cond_end, new_cond_start, new_cond_end) pipe['loader_settings']['negative'] = negative_wildcard_prompt pipe['loader_settings']['negative_token_normalization'] = negative_token_normalization @@ -4212,6 +4212,9 @@ class pipeEdit: "samples": samples, "images": image, "seed": pipe.get('seed') if pipe is not None and "seed" in pipe else None, + "loader_settings":{ + **pipe["loader_settings"] + } } del pipe diff --git a/py/libs/conditioning.py b/py/libs/conditioning.py index 5072de7..bcb4ab9 100644 --- a/py/libs/conditioning.py +++ b/py/libs/conditioning.py @@ -5,7 +5,7 @@ from ..wildcards import process_with_loras from nodes import ConditioningConcat, ConditioningCombine, ConditioningAverage, ConditioningSetTimestepRange -def prompt_to_cond(type, model, clip, clip_skip, lora_stack, text, prompt_token_normalization, prompt_weight_interpretation, a1111_prompt_style ,my_unique_id, prompt, easyCache, can_load_lora=True): +def prompt_to_cond(type, model, clip, clip_skip, lora_stack, text, prompt_token_normalization, prompt_weight_interpretation, a1111_prompt_style ,my_unique_id, prompt, easyCache, can_load_lora=True, steps=None): styles_selector = is_linked_styles_selector(prompt, my_unique_id, type) title = "正面提示词" if type == 'positive' else "负面提示词" log_node_warn("正在处理" + title + "...") @@ -19,7 +19,7 @@ def prompt_to_cond(type, model, clip, clip_skip, lora_stack, text, prompt_token_ clipped.clip_layer(clip_skip) log_node_warn("正在处理" + title + "编码...") - steps = find_nearest_steps(my_unique_id, prompt) + steps = steps if steps is not None else find_nearest_steps(my_unique_id, prompt) return (advanced_encode(clipped, text, prompt_token_normalization, prompt_weight_interpretation, w_max=1.0, apply_to_pooled='enable',