commit PurgeVRAM node, BooleanOperator node add min and max method
This commit is contained in:
+6
-2
@@ -25,7 +25,7 @@ class BooleanOperator:
|
||||
pass
|
||||
@classmethod
|
||||
def INPUT_TYPES(self):
|
||||
operator_list = ["==", "!=", "and", "or", "xor", "not(a)"]
|
||||
operator_list = ["==", "!=", "and", "or", "xor", "not(a)", "min", "max"]
|
||||
return {"required": {
|
||||
"a": (any, {}),
|
||||
"b": (any, {}),
|
||||
@@ -33,7 +33,7 @@ class BooleanOperator:
|
||||
},}
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN",)
|
||||
RETURN_NAMES = ("boolean",)
|
||||
RETURN_NAMES = ("output",)
|
||||
FUNCTION = 'bool_operator_node'
|
||||
CATEGORY = '😺dzNodes/LayerUtility'
|
||||
|
||||
@@ -51,6 +51,10 @@ class BooleanOperator:
|
||||
ret_value = not(a == b)
|
||||
if operator == "not(a)":
|
||||
ret_value = not a
|
||||
if operator == "min":
|
||||
ret_value = a or b
|
||||
if operator == "max":
|
||||
ret_value = a and b
|
||||
|
||||
return (ret_value,)
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
from .imagefunc import AnyType
|
||||
|
||||
any = AnyType("*")
|
||||
|
||||
NODE_NAME = 'PurgeVRAM'
|
||||
|
||||
class PurgeVRAM:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"anything": (any, {}),
|
||||
"purge_cache": ("BOOLEAN", {"default": True}),
|
||||
"purge_models": ("BOOLEAN", {"default": True}),
|
||||
},
|
||||
"optional": {
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "purge_vram"
|
||||
CATEGORY = '😺dzNodes/LayerUtility'
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def purge_vram(self, anything, purge_cache, purge_models):
|
||||
import torch.cuda
|
||||
import gc
|
||||
import comfy.model_management
|
||||
if purge_cache:
|
||||
if torch.cuda.is_available():
|
||||
gc.collect()
|
||||
torch.cuda.empty_cache()
|
||||
torch.cuda.ipc_collect()
|
||||
if purge_models:
|
||||
comfy.model_management.unload_all_models()
|
||||
|
||||
return (None,)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"LayerUtility: PurgeVRAM": PurgeVRAM
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"LayerUtility: PurgeVRAM": "LayerUtility: Purge VRAM"
|
||||
}
|
||||
Reference in New Issue
Block a user