@@ -272,11 +272,11 @@ def brushnet_model_update(self, model, vae, image, mask, brushnet, positive, neg
272
272
273
273
# unload vae
274
274
del vae
275
- for loaded_model in comfy .model_management .current_loaded_models :
276
- if type (loaded_model .model .model ) in ModelsToUnload :
277
- comfy .model_management .current_loaded_models .remove (loaded_model )
278
- loaded_model .model_unload ()
279
- del loaded_model
275
+ # for loaded_model in comfy.model_management.current_loaded_models:
276
+ # if type(loaded_model.model.model) in ModelsToUnload:
277
+ # comfy.model_management.current_loaded_models.remove(loaded_model)
278
+ # loaded_model.model_unload()
279
+ # del loaded_model
280
280
281
281
# prepare embeddings
282
282
prompt_embeds = positive [0 ][0 ].to (dtype = torch_dtype ).to (brushnet ['brushnet' ].device )
@@ -449,11 +449,11 @@ def powerpaint_model_update(self, model, vae, image, mask, powerpaint, clip, pos
449
449
# unload vae and CLIPs
450
450
del vae
451
451
del clip
452
- for loaded_model in comfy .model_management .current_loaded_models :
453
- if type (loaded_model .model .model ) in ModelsToUnload :
454
- comfy .model_management .current_loaded_models .remove (loaded_model )
455
- loaded_model .model_unload ()
456
- del loaded_model
452
+ # for loaded_model in comfy.model_management.current_loaded_models:
453
+ # if type(loaded_model.model.model) in ModelsToUnload:
454
+ # comfy.model_management.current_loaded_models.remove(loaded_model)
455
+ # loaded_model.model_unload()
456
+ # del loaded_model
457
457
458
458
# apply patch to model
459
459
@@ -663,8 +663,16 @@ def add_brushnet_patch(model, brushnet, torch_dtype, conditioning_latents,
663
663
664
664
is_SDXL = isinstance (model .model .model_config , comfy .supported_models .SDXL )
665
665
666
+ if model .model .model_config .custom_operations is None :
667
+ fp8 = model .model .model_config .optimizations .get ("fp8" , model .model .model_config .scaled_fp8 is not None )
668
+ operations = comfy .ops .pick_operations (model .model .model_config .unet_config .get ("dtype" , None ), model .model .manual_cast_dtype ,
669
+ fp8_optimizations = fp8 , scaled_fp8 = model .model .model_config .scaled_fp8 )
670
+ else :
671
+ # such as gguf
672
+ operations = model .model .model_config .custom_operations
673
+
666
674
if is_SDXL :
667
- input_blocks = [[0 , comfy . ops . manual_cast .Conv2d ],
675
+ input_blocks = [[0 , operations .Conv2d ],
668
676
[1 , comfy .ldm .modules .diffusionmodules .openaimodel .ResBlock ],
669
677
[2 , comfy .ldm .modules .diffusionmodules .openaimodel .ResBlock ],
670
678
[3 , comfy .ldm .modules .diffusionmodules .openaimodel .Downsample ],
@@ -686,7 +694,7 @@ def add_brushnet_patch(model, brushnet, torch_dtype, conditioning_latents,
686
694
[7 , comfy .ldm .modules .diffusionmodules .openaimodel .ResBlock ],
687
695
[8 , comfy .ldm .modules .diffusionmodules .openaimodel .ResBlock ]]
688
696
else :
689
- input_blocks = [[0 , comfy . ops . manual_cast .Conv2d ],
697
+ input_blocks = [[0 , operations .Conv2d ],
690
698
[1 , comfy .ldm .modules .attention .SpatialTransformer ],
691
699
[2 , comfy .ldm .modules .attention .SpatialTransformer ],
692
700
[3 , comfy .ldm .modules .diffusionmodules .openaimodel .Downsample ],
0 commit comments