Initial
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# ComfyUI LatentGC_Aggressive
|
||||
|
||||
Contains a single node for ComfyUI (https://github.com/comfyanonymous/ComfyUI) that on being hit empties cache, runs GC and unloads models from VRAM. Useful to put between different stages of the workflow in low VRAM scenarios. Suggested use is before/after sampler, before VFI, etc. The performance impact of unloading models from VRAM and, in some cases, forcing an immediate re-load for the next node use, appears negligible on this system.
|
||||
|
||||
Thanks to:
|
||||
https://github.com/ntdviet/comfyui-ext
|
||||
https://github.com/yolain/ComfyUI-Easy-Use
|
||||
@@ -0,0 +1,2 @@
|
||||
from .nodes import NODE_CLASS_MAPPINGS
|
||||
__all__ = ["NODE_CLASS_MAPPINGS"]
|
||||
@@ -0,0 +1,30 @@
|
||||
import torch
|
||||
import comfy.model_management as mm
|
||||
import gc
|
||||
|
||||
class LatentGC_Aggressive:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"samples": ("LATENT",),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "tunnelLatents"
|
||||
CATEGORY = "latent"
|
||||
|
||||
def tunnelLatents(self, samples):
|
||||
s = samples.copy()
|
||||
gc.collect()
|
||||
mm.unload_all_models()
|
||||
mm.soft_empty_cache()
|
||||
return (s,)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"LatentGC": LatentGC_Aggressive,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "comfyui-latentgc_aggressive"
|
||||
description = "This extension provides a node that aggressively empties the VRAM inbetween workflow stages, for low VRAM environments."
|
||||
version = "1.0.0"
|
||||
license = "LICENSE"
|
||||
dependencies = []
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/ltdrdata/ComfyUI-Impact-Pack"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = ""
|
||||
DisplayName = "ComfyUI-LatentGC_Aggressive"
|
||||
Icon = ""
|
||||
Reference in New Issue
Block a user