Skip to content

Commit

Permalink
improve: LBW - efficient patch
Browse files Browse the repository at this point in the history
fix: LBW - preset patch
  • Loading branch information
ltdrdata committed Aug 17, 2024
1 parent 30974e6 commit f64c987
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 64 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import importlib

version_code = [0, 85]
version_code = [0, 85, 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})")

Expand Down
8 changes: 6 additions & 2 deletions inspire/lora_block_weight.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ def parse_unet_num(s):

last_k_unet_num = k_unet_num

new_modelpatcher.add_patches({k: v}, strength_model * populated_ratio)
if populated_ratio > 0:
new_modelpatcher.add_patches({k: v}, strength_model * populated_ratio)

# if inverse:
# print(f"\t{k_unet} -> inv({ratio}) ")
# else:
Expand Down Expand Up @@ -500,7 +502,7 @@ def doit(self, lora_name, strength_model, strength_clip, inverse, seed, A, B, pr
XY_Capsule_LoraBlockWeight(0, 2, '', 'diff', storage, common_params),
XY_Capsule_LoraBlockWeight(0, 3, '', 'heatmap', storage, common_params)]

return ((xy_type, x_values), (xy_type, y_values), )
return (xy_type, x_values), (xy_type, y_values),


class LoraBlockInfo:
Expand Down Expand Up @@ -641,6 +643,8 @@ def parse_unet_num(s):
input_blocks = sorted(input_blocks)
middle_blocks = sorted(middle_blocks)
output_blocks = sorted(output_blocks)
double_blocks = sorted(double_blocks)
single_blocks = sorted(single_blocks)
others = sorted(others)

if len(input_block_count) > 0:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "0.84.1"
version = "0.85.1"
license = { file = "LICENSE" }
dependencies = ["matplotlib", "cachetools"]

Expand Down
130 changes: 70 additions & 60 deletions resources/lbw-preset.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ SDXL-LyC-ALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
SDXL-LyC-INALL:1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
SDXL-LyC-MIDALL:1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0
SDXL-LyC-OUTALL:1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1
FLUX-DBL-FRONT:1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
FLUX-DBL-MID:0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0
FLUX-DBL-TAIL:0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1
FLUX-DBL-ALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
FLUX-DBL-FRONT7:1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0
FLUX-DBL-MID6:1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0
FLUX-DBL-TAIL6:1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1
FLUX-SINGLE-ALL:1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
FLUX-SINGLE-1to10:1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
FLUX-SINGLE-11to20:1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
FLUX-SINGLE-21to30:1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
FLUX-SINGLE-31to37:1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1
FLUX-ALL:1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
@SD-FULL-TEST:17
@SD-BLOCK1-TEST:17,12,1
@SD-BLOCK2-TEST:17,12,2
Expand All @@ -53,60 +60,63 @@ FLUX-DBL-TAIL:0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1
@SD-LyC-FULL-TEST:27
@SDXL-FULL-TEST:12
@SDXL-LyC-FULL-TEST:21
@FLUX-DBL-FULL:18
@FLUX-DBL-SGL-FULL:55
@FLUX-DBL1-TEST:18,14,1
@FLUX-DBL2-TEST:18,14,2
@FLUX-DBL3-TEST:18,14,3
@FLUX-DBL4-TEST:18,14,4
@FLUX-DBL5-TEST:18,14,5
@FLUX-DBL6-TEST:18,14,6
@FLUX-DBL7-TEST:18,14,7
@FLUX-DBL8-TEST:18,14,8
@FLUX-DBL9-TEST:18,14,9
@FLUX-DBL10-TEST:18,14,10
@FLUX-DBL11-TEST:18,14,11
@FLUX-DBL12-TEST:18,14,12
@FLUX-DBL13-TEST:18,14,13
@FLUX-DBL14-TEST:18,14,14
@FLUX-DBL15-TEST:18,14,15
@FLUX-DBL16-TEST:18,14,16
@FLUX-DBL17-TEST:18,14,17
@FLUX-DBL18-TEST:18,14,18
@FLUX-SGL1-TEST:55,6,19
@FLUX-SGL2-TEST:55,6,20
@FLUX-SGL3-TEST:55,6,21
@FLUX-SGL4-TEST:55,6,22
@FLUX-SGL5-TEST:55,6,23
@FLUX-SGL6-TEST:55,6,24
@FLUX-SGL7-TEST:55,6,25
@FLUX-SGL8-TEST:55,6,26
@FLUX-SGL9-TEST:55,6,27
@FLUX-SGL10-TEST:55,6,28
@FLUX-SGL11-TEST:55,6,29
@FLUX-SGL12-TEST:55,6,30
@FLUX-SGL13-TEST:55,6,31
@FLUX-SGL14-TEST:55,6,32
@FLUX-SGL15-TEST:55,6,33
@FLUX-SGL16-TEST:55,6,34
@FLUX-SGL17-TEST:55,6,35
@FLUX-SGL18-TEST:55,6,36
@FLUX-SGL19-TEST:55,6,37
@FLUX-SGL20-TEST:55,6,38
@FLUX-SGL21-TEST:55,6,39
@FLUX-SGL22-TEST:55,6,40
@FLUX-SGL23-TEST:55,6,41
@FLUX-SGL24-TEST:55,6,42
@FLUX-SGL25-TEST:55,6,43
@FLUX-SGL26-TEST:55,6,44
@FLUX-SGL27-TEST:55,6,45
@FLUX-SGL28-TEST:55,6,46
@FLUX-SGL29-TEST:55,6,47
@FLUX-SGL30-TEST:55,6,48
@FLUX-SGL31-TEST:55,6,49
@FLUX-SGL32-TEST:55,6,50
@FLUX-SGL33-TEST:55,6,51
@FLUX-SGL34-TEST:55,6,52
@FLUX-SGL35-TEST:55,6,53
@FLUX-SGL36-TEST:55,6,54
@FLUX-SGL37-TEST:55,6,55
@FLUX-DBL-FULL:19
@FLUX-DBL-SGL-FULL:58
@FLUX-DBL0-TEST:19,14,2
@FLUX-DBL1-TEST:19,14,3
@FLUX-DBL2-TEST:19,14,4
@FLUX-DBL3-TEST:19,14,5
@FLUX-DBL4-TEST:19,14,6
@FLUX-DBL5-TEST:19,14,7
@FLUX-DBL6-TEST:19,14,8
@FLUX-DBL7-TEST:19,14,9
@FLUX-DBL8-TEST:19,14,10
@FLUX-DBL9-TEST:19,14,11
@FLUX-DBL10-TEST:19,14,12
@FLUX-DBL11-TEST:19,14,13
@FLUX-DBL12-TEST:19,14,14
@FLUX-DBL13-TEST:19,14,15
@FLUX-DBL14-TEST:19,14,16
@FLUX-DBL15-TEST:19,14,17
@FLUX-DBL16-TEST:19,14,18
@FLUX-DBL17-TEST:19,14,19
@FLUX-DBL18-TEST:19,14,20
@FLUX-SGL0-TEST:58,6,21
@FLUX-SGL1-TEST:58,6,22
@FLUX-SGL2-TEST:58,6,23
@FLUX-SGL3-TEST:58,6,24
@FLUX-SGL4-TEST:58,6,25
@FLUX-SGL5-TEST:58,6,26
@FLUX-SGL6-TEST:58,6,27
@FLUX-SGL7-TEST:58,6,28
@FLUX-SGL8-TEST:58,6,29
@FLUX-SGL9-TEST:58,6,30
@FLUX-SGL10-TEST:58,6,31
@FLUX-SGL11-TEST:58,6,32
@FLUX-SGL12-TEST:58,6,33
@FLUX-SGL13-TEST:58,6,34
@FLUX-SGL14-TEST:58,6,35
@FLUX-SGL15-TEST:58,6,36
@FLUX-SGL16-TEST:58,6,37
@FLUX-SGL17-TEST:58,6,38
@FLUX-SGL18-TEST:58,6,39
@FLUX-SGL19-TEST:58,6,40
@FLUX-SGL20-TEST:58,6,41
@FLUX-SGL21-TEST:58,6,42
@FLUX-SGL22-TEST:58,6,43
@FLUX-SGL23-TEST:58,6,44
@FLUX-SGL24-TEST:58,6,45
@FLUX-SGL25-TEST:58,6,46
@FLUX-SGL26-TEST:58,6,47
@FLUX-SGL27-TEST:58,6,48
@FLUX-SGL28-TEST:58,6,49
@FLUX-SGL29-TEST:58,6,50
@FLUX-SGL30-TEST:58,6,51
@FLUX-SGL31-TEST:58,6,52
@FLUX-SGL32-TEST:58,6,53
@FLUX-SGL33-TEST:58,6,54
@FLUX-SGL34-TEST:58,6,55
@FLUX-SGL35-TEST:58,6,56
@FLUX-SGL36-TEST:58,6,57
@FLUX-SGL37-TEST:58,6,58
@FLUX-SGL38-TEST:58,6,59

0 comments on commit f64c987

Please sign in to comment.