Add lora stacker support and fix TriggerWord Toggle node

This commit is contained in:
Will Miao
2025-03-11 20:46:40 +08:00
parent ad56cafd62
commit 79ebe25bc2
8 changed files with 21 additions and 26 deletions

View File

@@ -23,10 +23,7 @@ class LoraManagerLoader:
"placeholder": "LoRA syntax input: <lora:name:strength>"
}),
},
"optional": {
**FlexibleOptionalInputType(any_type),
"lora_stack": ("LORA_STACK", {"default": None}),
}
"optional": FlexibleOptionalInputType(any_type),
}
RETURN_TYPES = ("MODEL", "CLIP", IO.STRING)
@@ -58,12 +55,12 @@ class LoraManagerLoader:
basename = os.path.basename(lora_path)
return os.path.splitext(basename)[0]
def load_loras(self, model, clip, text, lora_stack=None, **kwargs):
print("load_loras kwargs: ", kwargs)
def load_loras(self, model, clip, text, **kwargs):
"""Loads multiple LoRAs based on the kwargs input and lora_stack."""
loaded_loras = []
all_trigger_words = []
lora_stack = kwargs.get('lora_stack', None)
# First process lora_stack if available
if lora_stack:
for lora_path, model_strength, clip_strength in lora_stack:

View File

@@ -20,10 +20,7 @@ class LoraStacker:
"placeholder": "LoRA syntax input: <lora:name:strength>"
}),
},
"optional": {
**FlexibleOptionalInputType(any_type),
"lora_stack": ("LORA_STACK", {"default": None}),
}
"optional": FlexibleOptionalInputType(any_type),
}
RETURN_TYPES = ("LORA_STACK", IO.STRING)
@@ -55,13 +52,13 @@ class LoraStacker:
basename = os.path.basename(lora_path)
return os.path.splitext(basename)[0]
def stack_loras(self, text, lora_stack=None, **kwargs):
print("stack_loras kwargs: ", kwargs)
def stack_loras(self, text, **kwargs):
"""Stacks multiple LoRAs based on the kwargs input without loading them."""
stack = []
all_trigger_words = []
# Process existing lora_stack if available
lora_stack = kwargs.get('lora_stack', None)
if lora_stack:
stack.extend(lora_stack)
# Get trigger words from existing stack entries

View File

@@ -24,7 +24,6 @@ class TriggerWordToggle:
FUNCTION = "process_trigger_words"
def process_trigger_words(self, id, **kwargs):
print("trigger_words ", kwargs)
trigger_words = kwargs.get("trigger_words", "")
# Send trigger words to frontend
PromptServer.instance.send_sync("trigger_word_update", {