diff --git a/__init__.py b/__init__.py index 3d4d31a..20c2f22 100644 --- a/__init__.py +++ b/__init__.py @@ -7,7 +7,7 @@ import importlib -version_code = [1, 6] +version_code = [1, 6, 1] version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') print(f"### Loading: ComfyUI-Inspire-Pack ({version_str})") diff --git a/inspire/lora_block_weight.py b/inspire/lora_block_weight.py index ed41f94..9ea5d2f 100644 --- a/inspire/lora_block_weight.py +++ b/inspire/lora_block_weight.py @@ -484,7 +484,7 @@ def load_lora_for_models(model, clip, lora, strength_model, strength_clip, inver if k in muted_weights: pass - elif 'text' in k: + elif 'text' in k or 'encoder' in k: new_clip.add_patches({k: weights}, strength_clip * ratio) else: new_modelpatcher.add_patches({k: weights}, strength_model * ratio) @@ -546,7 +546,7 @@ def doit(model, clip, strength_model, strength_clip, lbw_model): if k in muted_weights: pass - elif 'text' in k: + elif 'text' in k or 'encoder' in k: new_clip.add_patches({k: weights}, strength_clip * ratio) else: new_modelpatcher.add_patches({k: weights}, strength_model * ratio) @@ -822,9 +822,13 @@ def parse_unet_num(s): output_blocks = [] output_blocks_map = {} - text_block_count = set() - text_blocks = [] - text_blocks_map = {} + text_block_count1 = set() + text_blocks1 = [] + text_blocks_map1 = {} + + text_block_count2 = set() + text_blocks2 = [] + text_blocks_map2 = {} double_block_count = set() double_blocks = [] @@ -902,12 +906,23 @@ def parse_unet_num(s): k_unet_num = k_unet[len("er.text_model.encoder.layers."):len("er.text_model.encoder.layers.")+2] k_unet_int = parse_unet_num(k_unet_num) - text_block_count.add(k_unet_int) - text_blocks.append(k_unet) - if k_unet_int in text_blocks_map: - text_blocks_map[k_unet_int].append(k_unet) + text_block_count1.add(k_unet_int) + text_blocks1.append(k_unet) + if k_unet_int in text_blocks_map1: + text_blocks_map1[k_unet_int].append(k_unet) + else: + text_blocks_map1[k_unet_int] = [k_unet] + + elif k_unet.startswith("r.encoder.block."): + k_unet_num = k_unet[len("r.encoder.block."):len("r.encoder.block.")+2] + k_unet_int = parse_unet_num(k_unet_num) + + text_block_count2.add(k_unet_int) + text_blocks2.append(k_unet) + if k_unet_int in text_blocks_map2: + text_blocks_map2[k_unet_int].append(k_unet) else: - text_blocks_map[k_unet_int] = [k_unet] + text_blocks_map2[k_unet_int] = [k_unet] else: others.append(k_unet) @@ -951,10 +966,14 @@ def parse_unet_num(s): for x in single_keys: text += f" SINGLE{x}: {len(single_blocks_map[x])}\n" - text += f"\n-------[Base blocks] ({len(text_block_count) + len(others)}, Subs={len(text_blocks) + len(others)})-------\n" - text_keys = sorted(text_blocks_map.keys()) - for x in text_keys: - text += f" TXT_ENC{x}: {len(text_blocks_map[x])}\n" + text += f"\n-------[Base blocks] ({len(text_block_count1) + len(text_block_count2) + len(others)}, Subs={len(text_blocks1) + len(text_blocks2) + len(others)})-------\n" + text_keys1 = sorted(text_blocks_map1.keys()) + for x in text_keys1: + text += f" TXT_ENC{x}: {len(text_blocks_map1[x])}\n" + + text_keys2 = sorted(text_blocks_map2.keys()) + for x in text_keys2: + text += f" TXT_ENC{x} [B]: {len(text_blocks_map2[x])}\n" for x in others: text += f" {x}\n" diff --git a/pyproject.toml b/pyproject.toml index f552ed0..b3f1e5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-inspire-pack" description = "This extension provides various nodes to support Lora Block Weight and the Impact Pack. Provides many easily applicable regional features and applications for Variation Seed." -version = "1.6" +version = "1.6.1" license = { file = "LICENSE" } dependencies = ["matplotlib", "cachetools"]