From 6e67881e917c0847e88326048cf9eda7098914dd Mon Sep 17 00:00:00 2001 From: Mijago Date: Sun, 23 Jul 2023 20:13:18 +0200 Subject: [PATCH 1/4] Allow the loading of lora_stack without lora_name --- efficiency_nodes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/efficiency_nodes.py b/efficiency_nodes.py index b0496b0..3e142cc 100644 --- a/efficiency_nodes.py +++ b/efficiency_nodes.py @@ -88,8 +88,10 @@ class TSC_EfficientLoader: # Retrieve cache numbers vae_cache, ckpt_cache, lora_cache = get_cache_numbers("Efficient Loader") - if lora_name != "None": - lora_params = [(lora_name, lora_model_strength, lora_clip_strength)] + if lora_name != "None" or lora_stack is not None: + lora_params = [] + if lora_name != "None": + lora_params.append((lora_name, lora_model_strength, lora_clip_strength)) if lora_stack is not None: lora_params.extend(lora_stack) model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, cache_overwrite=True) From 264d553d9a058bc4fc2c9907c9f27ea13b229fbb Mon Sep 17 00:00:00 2001 From: Mijago Date: Wed, 26 Jul 2023 22:07:16 +0200 Subject: [PATCH 2/4] Improved readability --- efficiency_nodes.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/efficiency_nodes.py b/efficiency_nodes.py index 3e142cc..49d5316 100644 --- a/efficiency_nodes.py +++ b/efficiency_nodes.py @@ -89,12 +89,20 @@ class TSC_EfficientLoader: vae_cache, ckpt_cache, lora_cache = get_cache_numbers("Efficient Loader") if lora_name != "None" or lora_stack is not None: + # Initialize an empty list to store LoRa parameters. lora_params = [] + + # Check if lora_name is not the string "None" and if so, add its parameters. if lora_name != "None": lora_params.append((lora_name, lora_model_strength, lora_clip_strength)) - if lora_stack is not None: + + # If lora_stack is not None or an empty list, extend lora_params with its items. + if lora_stack: lora_params.extend(lora_stack) - model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, cache_overwrite=True) + + # If there are any parameters in lora_params, load the LoRa with them. + if lora_params: + model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, cache_overwrite=True) if vae_name == "Baked VAE": vae = get_bvae_by_ckpt_name(ckpt_name) else: From 0d6d47de50ef948a2d7476a39423013a45a2dd33 Mon Sep 17 00:00:00 2001 From: Mijago Date: Thu, 27 Jul 2023 08:02:25 +0200 Subject: [PATCH 3/4] modified check for lora_stack --- efficiency_nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/efficiency_nodes.py b/efficiency_nodes.py index 49d5316..87ddb9f 100644 --- a/efficiency_nodes.py +++ b/efficiency_nodes.py @@ -88,7 +88,7 @@ class TSC_EfficientLoader: # Retrieve cache numbers vae_cache, ckpt_cache, lora_cache = get_cache_numbers("Efficient Loader") - if lora_name != "None" or lora_stack is not None: + if lora_name != "None" or lora_stack: # Initialize an empty list to store LoRa parameters. lora_params = [] From fda12a4183b1049651bf0e9081c24b745926a08e Mon Sep 17 00:00:00 2001 From: Mijago Date: Thu, 27 Jul 2023 08:03:38 +0200 Subject: [PATCH 4/4] Removed unnecessary null check --- efficiency_nodes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/efficiency_nodes.py b/efficiency_nodes.py index 87ddb9f..19d4787 100644 --- a/efficiency_nodes.py +++ b/efficiency_nodes.py @@ -100,9 +100,9 @@ class TSC_EfficientLoader: if lora_stack: lora_params.extend(lora_stack) - # If there are any parameters in lora_params, load the LoRa with them. - if lora_params: - model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, cache_overwrite=True) + # Load LoRa(s) + model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, cache_overwrite=True) + if vae_name == "Baked VAE": vae = get_bvae_by_ckpt_name(ckpt_name) else: