From 0459710c9bbd4101cb716e1cb9d0318f9a0c7307 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Wed, 26 Mar 2025 21:50:26 +0800 Subject: [PATCH] Made CLIP input optional in LoRA Loader, enabling compatibility with Hunyuan workflows --- py/nodes/lora_loader.py | 5 +++-- py/services/recipe_scanner.py | 3 --- web/comfyui/lora_loader.js | 4 ++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/py/nodes/lora_loader.py b/py/nodes/lora_loader.py index d0bde635..766a17ec 100644 --- a/py/nodes/lora_loader.py +++ b/py/nodes/lora_loader.py @@ -18,7 +18,7 @@ class LoraManagerLoader: return { "required": { "model": ("MODEL",), - "clip": ("CLIP",), + # "clip": ("CLIP",), "text": (IO.STRING, { "multiline": True, "dynamicPrompts": True, @@ -75,11 +75,12 @@ class LoraManagerLoader: logger.warning(f"Unexpected loras format: {type(loras_data)}") return [] - def load_loras(self, model, clip, text, **kwargs): + def load_loras(self, model, text, **kwargs): """Loads multiple LoRAs based on the kwargs input and lora_stack.""" loaded_loras = [] all_trigger_words = [] + clip = kwargs.get('clip', None) lora_stack = kwargs.get('lora_stack', None) # First process lora_stack if available if lora_stack: diff --git a/py/services/recipe_scanner.py b/py/services/recipe_scanner.py index 6ef70c8b..01bfb9b0 100644 --- a/py/services/recipe_scanner.py +++ b/py/services/recipe_scanner.py @@ -2,16 +2,13 @@ import os import logging import asyncio import json -import re from typing import List, Dict, Optional, Any -from datetime import datetime from ..config import config from .recipe_cache import RecipeCache from .lora_scanner import LoraScanner from .civitai_client import CivitaiClient from ..utils.utils import fuzzy_match import sys -from contextlib import asynccontextmanager logger = logging.getLogger(__name__) diff --git a/web/comfyui/lora_loader.js b/web/comfyui/lora_loader.js index 61a1df54..815b1a1c 100644 --- a/web/comfyui/lora_loader.js +++ b/web/comfyui/lora_loader.js @@ -35,6 +35,10 @@ app.registerExtension({ // Enable widget serialization node.serialize_widgets = true; + node.addInput('clip', 'CLIP', { + "shape": 7 + }); + node.addInput("lora_stack", 'LORA_STACK', { "shape": 7 // 7 is the shape of the optional input });