XY_flip LoRA Batch fix (#275)

* Changed min values allowed for Y in TSC_XYplot_LoRA_Plot to include negative values.

* Fixed xy_flip for special case of LoRA Batch
This commit is contained in:
Stefano Ariotta
2025-04-02 10:37:42 +02:00
committed by GitHub
parent d0418549f7
commit 11effed8d1

View File

@@ -1004,7 +1004,8 @@ class TSC_KSampler:
# Special cases
is_special_case = (
(X_type == "Refiner On/Off" and Y_type in ["RefineStep", "Steps"]) or
(X_type == "Nothing" and Y_type != "Nothing")
(X_type == "Nothing" and Y_type != "Nothing") or
(Y_type == "LoRA Batch" and (X_type == "LoRA Wt" or X_type == "LoRA MStr" or X_type == "LoRA CStr"))
)
# Determine whether to flip
@@ -1712,6 +1713,11 @@ class TSC_KSampler:
# Check for all possible LoRA types
lora_types = ["LoRA", "LoRA Stacks", "LoRA Batch", "LoRA Wt", "LoRA MStr", "LoRA CStr"]
def get_lora_name_for_weights(lora_path, lora_name):
if lora_path:
return os.path.basename(X_value[0][0][0]) if lora_name is None else lora_name
return None
if X_type not in lora_types and Y_type not in lora_types:
if lora_stack:
names_list = []
@@ -1732,15 +1738,15 @@ class TSC_KSampler:
lora_model_str = X_value[0][0][1] if lora_model_str is None else lora_model_str
lora_clip_str = X_value[0][0][2] if lora_clip_str is None else lora_clip_str
elif X_type == "LoRA MStr":
lora_name = os.path.basename(X_value[0][0][0]) if lora_name is None else lora_name
lora_name = get_lora_name_for_weights(X_value[0][0][0], lora_name)
lora_model_str = value
lora_clip_str = X_value[0][0][2] if lora_clip_str is None else lora_clip_str
elif X_type == "LoRA CStr":
lora_name = os.path.basename(X_value[0][0][0]) if lora_name is None else lora_name
lora_name = get_lora_name_for_weights(X_value[0][0][0], lora_name)
lora_model_str = X_value[0][0][1] if lora_model_str is None else lora_model_str
lora_clip_str = value
elif X_type == "LoRA Wt":
lora_name = os.path.basename(X_value[0][0][0]) if lora_name is None else lora_name
lora_name = get_lora_name_for_weights(X_value[0][0][0], lora_name)
lora_wt = value
if Y_type in lora_types:
@@ -1754,15 +1760,15 @@ class TSC_KSampler:
lora_model_str = Y_value[0][0][1] if lora_model_str is None else lora_model_str
lora_clip_str = Y_value[0][0][2] if lora_clip_str is None else lora_clip_str
elif Y_type == "LoRA MStr":
lora_name = os.path.basename(Y_value[0][0][0]) if lora_name is None else lora_name
lora_name = get_lora_name_for_weights(Y_value[0][0][0], lora_name)
lora_model_str = value
lora_clip_str = Y_value[0][0][2] if lora_clip_str is None else lora_clip_str
elif Y_type == "LoRA CStr":
lora_name = os.path.basename(Y_value[0][0][0]) if lora_name is None else lora_name
lora_name = get_lora_name_for_weights(Y_value[0][0][0], lora_name)
lora_model_str = Y_value[0][0][1] if lora_model_str is None else lora_model_str
lora_clip_str = value
elif Y_type == "LoRA Wt":
lora_name = os.path.basename(Y_value[0][0][0]) if lora_name is None else lora_name
lora_name = get_lora_name_for_weights(Y_value[0][0][0], lora_name)
lora_wt = value
return lora_name, lora_wt, lora_model_str, lora_clip_str
@@ -3043,8 +3049,8 @@ class TSC_XYplot_LoRA_Plot:
"X_first_value": ("FLOAT", {"default": 0.0, "min": 0.00, "max": 10.0, "step": 0.01}),
"X_last_value": ("FLOAT", {"default": 1.0, "min": 0.00, "max": 10.0, "step": 0.01}),
"Y_batch_count": ("INT", {"default": XYPLOT_DEF, "min": 0, "max": XYPLOT_LIM}),
"Y_first_value": ("FLOAT", {"default": 0.0, "min": 0.00, "max": 10.0, "step": 0.01}),
"Y_last_value": ("FLOAT", {"default": 1.0, "min": 0.00, "max": 10.0, "step": 0.01}),},
"Y_first_value": ("FLOAT", {"default": 0.0, "min": -10.00, "max": 10.0, "step": 0.01}),
"Y_last_value": ("FLOAT", {"default": 1.0, "min": -10.00, "max": 10.0, "step": 0.01}),},
"optional": {"lora_stack": ("LORA_STACK",)}
}