Skip to content

Commit 3d2f0d8

Browse files
committed
add disabling of dynamic vram with widget to switch it
1 parent 9af6402 commit 3d2f0d8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

nodes/loader_nodes.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def INPUT_TYPES(cls):
179179
"unet_name": (folder_paths.get_filename_list("diffusion_models"),),
180180
"quant_format": (["auto", "int8", "int8_tensorwise", "float8_e4m3fn", "float8_e4m3fn_blockwise", "float8_e4m3fn_rowwise", "mxfp8", "hybrid_mxfp8", "nvfp4"],),
181181
"kernel_backend": (["pytorch", "triton"],),
182+
"disable_dynamic": ("BOOLEAN", {"default": True}),
182183
},
183184
}
184185

@@ -187,7 +188,7 @@ def INPUT_TYPES(cls):
187188
CATEGORY = "loaders/quantized"
188189
DESCRIPTION = "Load diffusion models with custom quantization support. int8_tensorwise uses torch._int_mm for fast inference."
189190

190-
def load_unet(self, unet_name, quant_format, kernel_backend):
191+
def load_unet(self, unet_name, quant_format, kernel_backend, disable_dynamic):
191192
"""Load a UNET model with the specified settings."""
192193

193194
# Set kernel backend (only for INT8 blockwise format)
@@ -255,7 +256,7 @@ def load_unet(self, unet_name, quant_format, kernel_backend):
255256
sd = comfy.utils.load_torch_file(unet_path, safe_load=True)
256257

257258
# Build model from state dict
258-
model = comfy.sd.load_diffusion_model_state_dict(sd, model_options=model_options)
259+
model = comfy.sd.load_diffusion_model_state_dict(sd, model_options=model_options, disable_dynamic=disable_dynamic)
259260

260261
return (model,)
261262

@@ -304,6 +305,7 @@ def INPUT_TYPES(cls):
304305
"type": (cls.CLIP_TYPES,),
305306
"quant_format": (["auto", "int8", "int8_tensorwise", "float8_e4m3fn", "float8_e4m3fn_blockwise", "float8_e4m3fn_rowwise", "mxfp8", "hybrid_mxfp8", "nvfp4"],),
306307
"kernel_backend": (["pytorch", "triton"],),
308+
"disable_dynamic": ("BOOLEAN", {"default": True}),
307309
},
308310
}
309311

@@ -312,7 +314,7 @@ def INPUT_TYPES(cls):
312314
CATEGORY = "loaders/quantized"
313315
DESCRIPTION = "Load quantized text encoders (CLIP, T5, etc.). int8_tensorwise uses torch._int_mm for fast inference."
314316

315-
def load_clip(self, clip_name, type, quant_format, kernel_backend):
317+
def load_clip(self, clip_name, type, quant_format, kernel_backend, disable_dynamic):
316318
"""Load a CLIP/text encoder with quantization support."""
317319
import comfy.model_management
318320

@@ -392,6 +394,7 @@ def load_clip(self, clip_name, type, quant_format, kernel_backend):
392394
clip_type=clip_type,
393395
model_options=model_options,
394396
embedding_directory=folder_paths.get_folder_paths("embeddings"),
397+
disable_dynamic=disable_dynamic,
395398
)
396399

397400
return (clip,)

0 commit comments

Comments
 (0)