Skip to content

Commit e40de4c

Browse files
authored
Merge pull request #127 from pollockjj/issue/#125
Issue/#125
2 parents bdd612c + 6c3e938 commit e40de4c

23 files changed

Lines changed: 3219 additions & 194 deletions

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ All MultiGPU nodes available for your install can be found in the "multigpu" cat
137137

138138
## Node Documentation
139139

140-
Detailed technical documentation is available for all **automatically-detected core MultiGPU and DisTorch2 nodes**, covering 36+ documented nodes with comprehensive parameter details, output specifications, and DisTorch2 allocation guidance where applicable.
140+
Detailed technical documentation is available for all **automatically-detected core MultiGPU and DisTorch2 nodes**, covering 70+ documented nodes with comprehensive parameter details, output specifications, and DisTorch2 allocation guidance where applicable.
141141

142142
- **To access documentation**: Click on any core MultiGPU or DisTorch2 node in ComfyUI and select "Help" (question mark inside a circle) from the resultant menu
143143
- **Coverage**: All standard ComfyUI loader nodes (UNet, VAE, Checkpoints, CLIP, ControlNet, Diffusers) plus popular GGUF loader variants
@@ -253,19 +253,6 @@ All workflows have been tested on a 2x 3090 + 1060ti linux setup, a 4070 win 11
253253
</tr>
254254
</table>
255255

256-
### Florence2
257-
258-
<table>
259-
<tr>
260-
<td align="center">
261-
<a href="example_workflows/ComfyUI-Florence2%20detailed_caption%20to%20flux.json">
262-
<img src="example_workflows/ComfyUI-Florence2%20detailed_caption%20to%20flux.jpg" alt="Florence2 Detailed Caption to FLUX Pipeline" style="max-width:160px; max-height:160px;">
263-
<div>Florence2 Detailed Caption to FLUX Pipeline</div>
264-
</a>
265-
</td>
266-
</tr>
267-
</table>
268-
269256
### GGUF
270257

271258
<table>
@@ -286,7 +273,7 @@ All workflows have been tested on a 2x 3090 + 1060ti linux setup, a 4070 win 11
286273
</tr>
287274
</table>
288275

289-
### HunyuanVideoWrapper
276+
### HunyuanVideoWrapper / Florence2
290277

291278
<table>
292279
<tr>
@@ -296,6 +283,12 @@ All workflows have been tested on a 2x 3090 + 1060ti linux setup, a 4070 win 11
296283
<div>HunyuanVideoWrapper DisTorch (Legacy, Deprecated)</div>
297284
</a>
298285
</td>
286+
<td align="center">
287+
<a href="example_workflows/ComfyUI-Florence2%20detailed_caption%20to%20flux.json">
288+
<img src="example_workflows/ComfyUI-Florence2%20detailed_caption%20to%20flux.jpg" alt="Florence2 Detailed Caption to FLUX Pipeline" style="max-width:160px; max-height:160px;">
289+
<div>Florence2 Detailed Caption to FLUX Pipeline</div>
290+
</a>
291+
</td>
299292
</tr>
300293
</table>
301294

__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ def unet_offload_device_patched():
269269
override_class_with_distorch_safetensor_v2_clip_no_device,
270270
)
271271
from .distorch_2 import (
272-
safetensor_allocation_store,
273-
create_safetensor_model_hash,
274272
register_patched_safetensor_modelpatcher,
275273
analyze_safetensor_loading,
276274
calculate_safetensor_vvram_allocation,

checkpoint_multigpu.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from comfy.sd import VAE, CLIP
1010
from .device_utils import get_device_list, soft_empty_cache_multigpu
1111
from .model_management_mgpu import multigpu_memory_log
12-
from .distorch_2 import safetensor_allocation_store, safetensor_settings_store, create_safetensor_model_hash, register_patched_safetensor_modelpatcher
12+
from .distorch_2 import register_patched_safetensor_modelpatcher
1313

1414
logger = logging.getLogger("MultiGPU")
1515

@@ -108,12 +108,10 @@ def patched_load_state_dict_guess_config(sd, output_vae=True, output_clip=True,
108108

109109
if distorch_config and 'unet_allocation' in distorch_config:
110110
register_patched_safetensor_modelpatcher()
111-
model_hash = create_safetensor_model_hash(model_patcher, "checkpoint_loader_unet")
112-
safetensor_allocation_store[model_hash] = distorch_config['unet_allocation']
113-
safetensor_settings_store[model_hash] = distorch_config.get('unet_settings','')
114-
model.is_distorch = True
111+
inner_model = model_patcher.model
112+
inner_model._distorch_v2_meta = {"full_allocation": distorch_config['unet_allocation']}
113+
logger.info(f"[CHECKPOINT_META] UNET inner_model id=0x{id(inner_model):x}")
115114
model._distorch_high_precision_loras = distorch_config.get('high_precision_loras', True)
116-
logger.mgpu_mm_log(f"Stored DisTorch2 config for UNet (hash {model_hash[:8]}): {distorch_config['unet_allocation']}")
117115

118116
model.load_model_weights(sd, diffusion_model_prefix)
119117
multigpu_memory_log(f"unet:{config_hash[:8]}", "post-weights")
@@ -145,12 +143,10 @@ def patched_load_state_dict_guess_config(sd, output_vae=True, output_clip=True,
145143
if distorch_config and 'clip_allocation' in distorch_config:
146144
if hasattr(clip, 'patcher'):
147145
register_patched_safetensor_modelpatcher()
148-
clip_hash = create_safetensor_model_hash(clip.patcher, "checkpoint_loader_clip")
149-
safetensor_allocation_store[clip_hash] = distorch_config['clip_allocation']
150-
safetensor_settings_store[clip_hash] = distorch_config.get('clip_settings','')
151-
clip.patcher.model.is_distorch = True
146+
inner_clip = clip.patcher.model
147+
inner_clip._distorch_v2_meta = {"full_allocation": distorch_config['clip_allocation']}
148+
logger.info(f"[CHECKPOINT_META] CLIP inner_model id=0x{id(inner_clip):x}")
152149
clip.patcher.model._distorch_high_precision_loras = distorch_config.get('high_precision_loras', True)
153-
logger.info(f"Stored DisTorch2 config for CLIP (hash {clip_hash[:8]}): {distorch_config['clip_allocation']}")
154150

155151
m, u = clip.load_sd(clip_sd, full_model=True) # This respects the patched text_encoder_device
156152
if len(m) > 0: logger.warning(f"CLIP missing keys: {m}")
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
{
2+
"6": {
3+
"inputs": {
4+
"text": [
5+
"47",
6+
2
7+
],
8+
"clip": [
9+
"39",
10+
0
11+
]
12+
},
13+
"class_type": "CLIPTextEncode",
14+
"_meta": {
15+
"title": "CLIP Text Encode (Positive Prompt)"
16+
}
17+
},
18+
"8": {
19+
"inputs": {
20+
"samples": [
21+
"13",
22+
0
23+
],
24+
"vae": [
25+
"40",
26+
0
27+
]
28+
},
29+
"class_type": "VAEDecode",
30+
"_meta": {
31+
"title": "VAE Decode"
32+
}
33+
},
34+
"9": {
35+
"inputs": {
36+
"filename_prefix": "MultiGPU",
37+
"images": [
38+
"8",
39+
0
40+
]
41+
},
42+
"class_type": "SaveImage",
43+
"_meta": {
44+
"title": "Save Image"
45+
}
46+
},
47+
"13": {
48+
"inputs": {
49+
"noise": [
50+
"25",
51+
0
52+
],
53+
"guider": [
54+
"22",
55+
0
56+
],
57+
"sampler": [
58+
"16",
59+
0
60+
],
61+
"sigmas": [
62+
"17",
63+
0
64+
],
65+
"latent_image": [
66+
"27",
67+
0
68+
]
69+
},
70+
"class_type": "SamplerCustomAdvanced",
71+
"_meta": {
72+
"title": "SamplerCustomAdvanced"
73+
}
74+
},
75+
"16": {
76+
"inputs": {
77+
"sampler_name": "euler"
78+
},
79+
"class_type": "KSamplerSelect",
80+
"_meta": {
81+
"title": "KSamplerSelect"
82+
}
83+
},
84+
"17": {
85+
"inputs": {
86+
"scheduler": "simple",
87+
"steps": 20,
88+
"denoise": 1,
89+
"model": [
90+
"30",
91+
0
92+
]
93+
},
94+
"class_type": "BasicScheduler",
95+
"_meta": {
96+
"title": "BasicScheduler"
97+
}
98+
},
99+
"22": {
100+
"inputs": {
101+
"model": [
102+
"30",
103+
0
104+
],
105+
"conditioning": [
106+
"26",
107+
0
108+
]
109+
},
110+
"class_type": "BasicGuider",
111+
"_meta": {
112+
"title": "BasicGuider"
113+
}
114+
},
115+
"25": {
116+
"inputs": {
117+
"noise_seed": 66527593966288
118+
},
119+
"class_type": "RandomNoise",
120+
"_meta": {
121+
"title": "RandomNoise"
122+
}
123+
},
124+
"26": {
125+
"inputs": {
126+
"guidance": 3.5,
127+
"conditioning": [
128+
"6",
129+
0
130+
]
131+
},
132+
"class_type": "FluxGuidance",
133+
"_meta": {
134+
"title": "FluxGuidance"
135+
}
136+
},
137+
"27": {
138+
"inputs": {
139+
"width": 1024,
140+
"height": 1024,
141+
"batch_size": 1
142+
},
143+
"class_type": "EmptySD3LatentImage",
144+
"_meta": {
145+
"title": "EmptySD3LatentImage"
146+
}
147+
},
148+
"30": {
149+
"inputs": {
150+
"max_shift": 1.15,
151+
"base_shift": 0.5,
152+
"width": 1024,
153+
"height": 1024,
154+
"model": [
155+
"38",
156+
0
157+
]
158+
},
159+
"class_type": "ModelSamplingFlux",
160+
"_meta": {
161+
"title": "ModelSamplingFlux"
162+
}
163+
},
164+
"38": {
165+
"inputs": {
166+
"unet_name": "flux1-dev-fp8.safetensors",
167+
"weight_dtype": "default",
168+
"device": "cuda:0"
169+
},
170+
"class_type": "UNETLoaderMultiGPU",
171+
"_meta": {
172+
"title": "UNETLoaderMultiGPU"
173+
}
174+
},
175+
"39": {
176+
"inputs": {
177+
"clip_name1": "t5xxl_fp8_e4m3fn_scaled.safetensors",
178+
"clip_name2": "clip_l.safetensors",
179+
"type": "flux",
180+
"device": "cpu"
181+
},
182+
"class_type": "DualCLIPLoaderMultiGPU",
183+
"_meta": {
184+
"title": "DualCLIPLoaderMultiGPU"
185+
}
186+
},
187+
"40": {
188+
"inputs": {
189+
"vae_name": "ae.safetensors",
190+
"device": "cuda:1"
191+
},
192+
"class_type": "VAELoaderMultiGPU",
193+
"_meta": {
194+
"title": "VAELoaderMultiGPU"
195+
}
196+
},
197+
"44": {
198+
"inputs": {
199+
"image": "ComfyUI-Florence2 detailed_caption to flux.jpg"
200+
},
201+
"class_type": "LoadImage",
202+
"_meta": {
203+
"title": "Load Image"
204+
}
205+
},
206+
"45": {
207+
"inputs": {
208+
"model": "MiaoshouAI/Florence-2-large-PromptGen-v2.0",
209+
"precision": "fp16",
210+
"attention": "sdpa",
211+
"convert_to_safetensors": "cuda:1",
212+
"device": "cuda:1",
213+
"offload_device": "cpu"
214+
},
215+
"class_type": "DownloadAndLoadFlorence2ModelMultiGPU",
216+
"_meta": {
217+
"title": "DownloadAndLoadFlorence2ModelMultiGPU"
218+
}
219+
},
220+
"47": {
221+
"inputs": {
222+
"text_input": "",
223+
"task": "detailed_caption",
224+
"fill_mask": true,
225+
"keep_model_loaded": true,
226+
"max_new_tokens": 4096,
227+
"num_beams": 3,
228+
"do_sample": true,
229+
"output_mask_select": "",
230+
"seed": 61577449829591,
231+
"image": [
232+
"44",
233+
0
234+
],
235+
"florence2_model": [
236+
"45",
237+
0
238+
]
239+
},
240+
"class_type": "Florence2Run",
241+
"_meta": {
242+
"title": "Florence2Run"
243+
}
244+
}
245+
}

0 commit comments

Comments
 (0)