mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-06-03 16:20:04 +08:00
Update nodes.py
This commit is contained in:
parent
8fc4794f88
commit
e362c926d3
@ -1853,12 +1853,22 @@ class FluxBlockLoraLoader:
|
|||||||
#print(filtered_dict)
|
#print(filtered_dict)
|
||||||
last_arg_size = 0
|
last_arg_size = 0
|
||||||
for arg in kwargs:
|
for arg in kwargs:
|
||||||
for key in loaded:
|
for key in list(loaded.keys()): # Convert keys to a list to avoid runtime error due to size change
|
||||||
if arg in key and last_arg_size < len(arg):
|
if arg in key and last_arg_size < len(arg):
|
||||||
ratio = kwargs[arg]
|
ratio = kwargs[arg]
|
||||||
value = loaded[key]
|
if ratio == 0:
|
||||||
last_arg_size = len(arg)
|
del loaded[key] # Remove the key if ratio is 0
|
||||||
loaded[key] = (value[0], value[1][:-3] + (ratio, value[1][-2], value[1][-1]))
|
else:
|
||||||
|
value = loaded[key]
|
||||||
|
last_arg_size = len(arg)
|
||||||
|
loaded[key] = (value[0], value[1][:-3] + (ratio, value[1][-2], value[1][-1]))
|
||||||
|
print("loading lora keys:")
|
||||||
|
for key, value in loaded.items():
|
||||||
|
if len(value) > 1 and len(value[1]) > 2:
|
||||||
|
alpha = value[1][-3] # Assuming the alpha value is the third last element in the tuple
|
||||||
|
else:
|
||||||
|
alpha = None
|
||||||
|
print(f"Key: {key}, Alpha: {alpha}")
|
||||||
if model is not None:
|
if model is not None:
|
||||||
new_modelpatcher = model.clone()
|
new_modelpatcher = model.clone()
|
||||||
k = new_modelpatcher.add_patches(loaded, strength_model)
|
k = new_modelpatcher.add_patches(loaded, strength_model)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user