mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-13 23:04:40 +08:00
fix dit lora block loader on loras with diff keys
This commit is contained in:
parent
dafbcae4e6
commit
87d0cf42db
@ -1935,22 +1935,29 @@ class DiTBlockLoraLoader:
|
|||||||
if ratio == 0:
|
if ratio == 0:
|
||||||
keys_to_delete.append(key)
|
keys_to_delete.append(key)
|
||||||
else:
|
else:
|
||||||
value = loaded[key].weights
|
# Only modify LoRA adapters, skip diff tuples
|
||||||
weights_list = list(loaded[key].weights)
|
value = loaded[key]
|
||||||
weights_list[2] = ratio
|
if hasattr(value, 'weights'):
|
||||||
loaded[key].weights = tuple(weights_list)
|
print(f"Modifying LoRA adapter for key: {key}")
|
||||||
|
weights_list = list(value.weights)
|
||||||
|
weights_list[2] = ratio
|
||||||
|
loaded[key].weights = tuple(weights_list)
|
||||||
|
else:
|
||||||
|
print(f"Skipping non-LoRA entry for key: {key}")
|
||||||
|
|
||||||
for key in keys_to_delete:
|
for key in keys_to_delete:
|
||||||
del loaded[key]
|
del loaded[key]
|
||||||
|
|
||||||
print("loading lora keys:")
|
print("loading lora keys:")
|
||||||
for key, value in loaded.items():
|
for key, value in loaded.items():
|
||||||
print(f"Key: {key}, Alpha: {value.weights[2]}")
|
if hasattr(value, 'weights'):
|
||||||
|
print(f"Key: {key}, Alpha: {value.weights[2]}")
|
||||||
|
else:
|
||||||
|
print(f"Key: {key}, Type: {type(value)}")
|
||||||
|
|
||||||
|
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)
|
|
||||||
|
|
||||||
k = set(k)
|
k = set(k)
|
||||||
for x in loaded:
|
for x in loaded:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user