mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-09 21:04:41 +08:00
update VRAM debug
This commit is contained in:
parent
ee3a982b6a
commit
1b9d469830
26
nodes.py
26
nodes.py
@ -1145,30 +1145,26 @@ class VRAM_Debug:
|
|||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"model": ("MODEL",),
|
"image_passthrough": ("IMAGE",),
|
||||||
"empty_cuda_cache": ("BOOLEAN", {"default": False}),
|
"empty_cache": ("BOOLEAN", {"default": True}),
|
||||||
|
"unload_all_models": ("BOOLEAN", {"default": False}),
|
||||||
},
|
},
|
||||||
"optional": {
|
|
||||||
"clip_vision": ("CLIP_VISION", ),
|
|
||||||
}
|
}
|
||||||
}
|
RETURN_TYPES = ("IMAGE", "INT", "INT",)
|
||||||
RETURN_TYPES = ("MODEL", "INT", "INT",)
|
RETURN_NAMES = ("image_passthrough", "freemem_before", "freemem_after")
|
||||||
RETURN_NAMES = ("model", "freemem_before", "freemem_after")
|
|
||||||
FUNCTION = "VRAMdebug"
|
FUNCTION = "VRAMdebug"
|
||||||
CATEGORY = "KJNodes"
|
CATEGORY = "KJNodes"
|
||||||
|
|
||||||
def VRAMdebug(self, model, empty_cuda_cache, clip_vision=None):
|
def VRAMdebug(self, image_passthrough, empty_cache, unload_all_models):
|
||||||
freemem_before = comfy.model_management.get_free_memory()
|
freemem_before = comfy.model_management.get_free_memory()
|
||||||
print(freemem_before)
|
print(freemem_before)
|
||||||
if empty_cuda_cache:
|
if empty_cache:
|
||||||
torch.cuda.empty_cache()
|
comfy.model_management.soft_empty_cache()
|
||||||
torch.cuda.ipc_collect()
|
if unload_all_models:
|
||||||
if clip_vision is not None:
|
comfy.model_management.unload_all_models()
|
||||||
print("unloading clip_vision_clone")
|
|
||||||
comfy.model_management.unload_model_clones(clip_vision.patcher)
|
|
||||||
freemem_after = comfy.model_management.get_free_memory()
|
freemem_after = comfy.model_management.get_free_memory()
|
||||||
print(freemem_after)
|
print(freemem_after)
|
||||||
return (model, freemem_before, freemem_after)
|
return (image_passthrough, freemem_before, freemem_after)
|
||||||
|
|
||||||
class AnyType(str):
|
class AnyType(str):
|
||||||
"""A special class that is always equal in not equal comparisons. Credit to pythongosssss"""
|
"""A special class that is always equal in not equal comparisons. Credit to pythongosssss"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user