Skip to content

Commit 5780122

Browse files
authored
Merge pull request #13 from silveroxides/refactor/incremental-writer
Refactor/incremental writer
2 parents 54bb662 + f6aac8c commit 5780122

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

nodes/lora_merger.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def extract_core_layer_lora(block_name: str) -> str:
123123
core_base = extract_core_layer_base(base_key)
124124
core_underscored = core_base.replace(".", "_")
125125
if core_underscored in lora_lookup:
126-
layer_map[core_base] = lora_lookup[core_underscored] # List of (idx, block_name)
126+
# Always use standard format with diffusion_model. prefix when reference model is provided
127+
output_key = core_base if core_base.startswith("diffusion_model.") else "diffusion_model." + core_base
128+
layer_map[output_key] = lora_lookup[core_underscored] # List of (idx, block_name)
127129
else:
128130
for i, info in enumerate(lora_infos):
129131
for block_name in info["pairs"].keys():
@@ -270,7 +272,7 @@ def extract_core_layer_lora(block_name: str) -> str:
270272
if verbose:
271273
matched_stats = {i: 0 for i in range(len(lora_paths))}
272274
for indices in layer_map.values():
273-
for idx in indices:
275+
for idx, block_name in indices:
274276
matched_stats[idx] += 1
275277

276278
print(f"[LoRA Multi-Merge] --- Merge Summary ---")
@@ -554,7 +556,9 @@ def extract_core_layer_lora(block_name: str) -> str:
554556
core_base = extract_core_layer_base(base_key)
555557
core_underscored = core_base.replace(".", "_")
556558
if core_underscored in lora_lookup:
557-
layer_map[core_base] = lora_lookup[core_underscored] # List of (idx, block_name)
559+
# Always use standard format with diffusion_model. prefix when reference model is provided
560+
output_key = core_base if core_base.startswith("diffusion_model.") else "diffusion_model." + core_base
561+
layer_map[output_key] = lora_lookup[core_underscored] # List of (idx, block_name)
558562
else:
559563
for i, info in enumerate(lora_infos):
560564
for block_name in info["pairs"].keys():
@@ -672,7 +676,7 @@ def process_ties_dare(tensors, weights, dim_to_pad):
672676
if verbose:
673677
matched_stats = {i: 0 for i in range(len(lora_paths))}
674678
for indices in layer_map.values():
675-
for idx in indices:
679+
for idx, block_name in indices:
676680
matched_stats[idx] += 1
677681

678682
print(f"[LoRA Multi-Merge DARE] --- Merge Summary ---")
@@ -870,7 +874,9 @@ def extract_core_layer_lora(block_name: str) -> str:
870874
core_base = extract_core_layer_base(base_key)
871875
core_underscored = core_base.replace(".", "_")
872876
if core_underscored in lora_lookup:
873-
layer_map[core_base] = lora_lookup[core_underscored] # List of (idx, block_name)
877+
# Always use standard format with diffusion_model. prefix when reference model is provided
878+
output_key = core_base if core_base.startswith("diffusion_model.") else "diffusion_model." + core_base
879+
layer_map[output_key] = lora_lookup[core_underscored] # List of (idx, block_name)
874880
else:
875881
for i, info in enumerate(lora_infos):
876882
for block_name in info["pairs"].keys():
@@ -990,7 +996,7 @@ def process_ties_dare_enhanced(tensors, weights, dim_to_pad):
990996
if verbose:
991997
matched_stats = {i: 0 for i in range(len(lora_paths))}
992998
for indices in layer_map.values():
993-
for idx in indices:
999+
for idx, block_name in indices:
9941000
matched_stats[idx] += 1
9951001

9961002
print(f"[LoRA Multi-Merge Enhanced DARE] --- Merge Summary ---")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "ComfyUI-ModelUtils"
33
description = "[WIP]Custom nodes for handling, inspecting, modifying and creating various model files."
4-
version = "0.4.0"
4+
version = "0.4.1"
55
license = { file = "LICENSE" }
66

77
classifiers = [

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
requests
22
Pillow
33
mutagen
4-
unifiedefficientloader==0.5.0
4+
unifiedefficientloader>=0.5.1
55
av

0 commit comments

Comments
 (0)