From 8752ea0f7781a759b45775e101d83d56a654d304 Mon Sep 17 00:00:00 2001 From: yolain Date: Sat, 9 Mar 2024 12:07:51 +0800 Subject: [PATCH] fix:generate wrong in layerdiffuse when negative is empty #80 --- py/adv_encode.py | 2 +- py/libs/conditioning.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/py/adv_encode.py b/py/adv_encode.py index 9fb666d..68d3a83 100644 --- a/py/adv_encode.py +++ b/py/adv_encode.py @@ -276,7 +276,7 @@ def advanced_encode(clip, text, token_normalization, weight_interpretation, w_ma pass3 = [x for x in pass3 if x != ''] if len(pass3) == 0: - return '' + pass3 = [''] # pass3_str = [f'[{x}]' for x in pass3] # print(f"CLIP: {str.join(' + ', pass3_str)}") diff --git a/py/libs/conditioning.py b/py/libs/conditioning.py index 0f06e49..5072de7 100644 --- a/py/libs/conditioning.py +++ b/py/libs/conditioning.py @@ -5,14 +5,14 @@ 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, positive_token_normalization, positive_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): styles_selector = is_linked_styles_selector(prompt, my_unique_id, type) title = "正面提示词" if type == 'positive' else "负面提示词" log_node_warn("正在处理" + title + "...") positive_seed = find_wildcards_seed(my_unique_id, text, prompt) - model, clip, positive, positive_decode, show_prompt, pipe_lora_stack = process_with_loras( + model, clip, text, cond_decode, show_prompt, pipe_lora_stack = process_with_loras( text, model, clip, type, positive_seed, can_load_lora, lora_stack, easyCache) - wildcard_prompt = positive_decode if show_prompt or styles_selector else "" + wildcard_prompt = cond_decode if show_prompt or styles_selector else "" clipped = clip.clone() if clip_skip != 0: @@ -20,8 +20,8 @@ def prompt_to_cond(type, model, clip, clip_skip, lora_stack, text, positive_toke log_node_warn("正在处理" + title + "编码...") steps = find_nearest_steps(my_unique_id, prompt) - return (advanced_encode(clipped, positive, positive_token_normalization, - positive_weight_interpretation, w_max=1.0, + return (advanced_encode(clipped, text, prompt_token_normalization, + prompt_weight_interpretation, w_max=1.0, apply_to_pooled='enable', a1111_prompt_style=a1111_prompt_style, steps=steps), wildcard_prompt, model, clipped)