diff --git a/__init__.py b/__init__.py index 24bd3b0..45d6e19 100644 --- a/__init__.py +++ b/__init__.py @@ -24,6 +24,7 @@ from .nodes import ( LTXVLoader, Florence2ModelLoader, DownloadAndLoadFlorence2Model, CheckpointLoaderNF4, + CLIPVisionLoader, LoadFluxControlNet, MMAudioModelLoader, MMAudioFeatureUtilsLoader, MMAudioSampler, PulidModelLoader, PulidInsightFaceLoader, PulidEvaClipLoader, @@ -58,8 +59,8 @@ mm.text_encoder_device = text_encoder_device_patched def create_model_hash(model, caller): model_type = type(model.model).__name__ - model_size = model.model_size() - first_layers = str(list(model.model_state_dict().keys())[:3]) + model_size = model.model_size() if hasattr(model, "model_size") else 0 + first_layers = str(list(model.model_state_dict().keys())[:3]) if hasattr(model, "model_state_dict") else "[]" identifier = f"{model_type}_{model_size}_{first_layers}" final_hash = hashlib.sha256(identifier.encode()).hexdigest() @@ -569,7 +570,7 @@ def override_class_with_distorch(cls): default_device = devices[1] if len(devices) > 1 else devices[0] inputs["optional"] = inputs.get("optional", {}) inputs["optional"]["device"] = (devices, {"default": default_device}) - inputs["optional"]["virtual_vram_gb"] = ("FLOAT", {"default": 4.0, "min": 0.0, "max": 24.0, "step": 0.1}) + inputs["optional"]["virtual_vram_gb"] = ("FLOAT", {"default": 4.0, "min": 0.0, "max": 99999999.0, "step": 0.1}) inputs["optional"]["use_other_vram"] = ("BOOLEAN", {"default": False}) inputs["optional"]["expert_mode_allocations"] = ("STRING", { "multiline": False, @@ -691,6 +692,7 @@ NODE_CLASS_MAPPINGS["MergeFluxLoRAsQuantizeAndLoaddMultiGPU"] = override_class(M NODE_CLASS_MAPPINGS["UNETLoaderMultiGPU"] = override_class(GLOBAL_NODE_CLASS_MAPPINGS["UNETLoader"]) NODE_CLASS_MAPPINGS["VAELoaderMultiGPU"] = override_class(GLOBAL_NODE_CLASS_MAPPINGS["VAELoader"]) NODE_CLASS_MAPPINGS["CLIPLoaderMultiGPU"] = override_class_clip(GLOBAL_NODE_CLASS_MAPPINGS["CLIPLoader"]) +NODE_CLASS_MAPPINGS["CLIPVisionLoaderDisTorchMultiGPU"] = override_class_with_distorch(CLIPVisionLoader) NODE_CLASS_MAPPINGS["DualCLIPLoaderMultiGPU"] = override_class_clip(GLOBAL_NODE_CLASS_MAPPINGS["DualCLIPLoader"]) NODE_CLASS_MAPPINGS["TripleCLIPLoaderMultiGPU"] = override_class_clip(GLOBAL_NODE_CLASS_MAPPINGS["TripleCLIPLoader"]) NODE_CLASS_MAPPINGS["QuadrupleCLIPLoaderMultiGPU"] = override_class_clip(GLOBAL_NODE_CLASS_MAPPINGS["QuadrupleCLIPLoader"]) @@ -745,5 +747,4 @@ if check_module_exists("ComfyUI-WanVideoWrapper") or check_module_exists("comfyu NODE_CLASS_MAPPINGS["WanVideoVAELoaderMultiGPU"] = override_class(WanVideoVAELoader) NODE_CLASS_MAPPINGS["LoadWanVideoT5TextEncoderMultiGPU"] = override_class(LoadWanVideoT5TextEncoder) - logging.info(f"MultiGPU: Registration complete. Final mappings: {', '.join(NODE_CLASS_MAPPINGS.keys())}") diff --git a/nodes.py b/nodes.py index 25456df..6250d39 100644 --- a/nodes.py +++ b/nodes.py @@ -1,7 +1,22 @@ import folder_paths +import nodes from pathlib import Path from nodes import NODE_CLASS_MAPPINGS +class CLIPVisionLoader: + NodeId = "CLIPVisionLoader" + NodeName = "Load CLIP Vision" + RETURN_TYPES = ("CLIP_VISION",) + FUNCTION = "load_clip" + CATEGORY = "loaders" + + @classmethod + def INPUT_TYPES(s): + return NODE_CLASS_MAPPINGS["CLIPVisionLoader"]().INPUT_TYPES() + + def load_clip(self, clip_name): + return NODE_CLASS_MAPPINGS["CLIPVisionLoader"]().load_clip(clip_name) + class UnetLoaderGGUF: @classmethod def INPUT_TYPES(s): @@ -43,7 +58,7 @@ class CLIPLoaderGGUF: return { "required": { "clip_name": (s.get_filename_list(),), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "wan"],), + "type": nodes.CLIPLoader.INPUT_TYPES()["required"]["type"], } }