diff --git a/py/kolors/model_patch.py b/py/kolors/model_patch.py index 63f1a2f..4721a57 100644 --- a/py/kolors/model_patch.py +++ b/py/kolors/model_patch.py @@ -1,8 +1,8 @@ import comfy.model_management import comfy.samplers +from torch.nn import Linear def add_model_patch(model, sd): - from torch.nn import Linear load_device = comfy.model_management.get_torch_device() encoder_hid_proj_weight = sd.pop("encoder_hid_proj.weight") encoder_hid_proj_bias = sd.pop("encoder_hid_proj.bias") diff --git a/py/libs/loader.py b/py/libs/loader.py index 46a3c28..bd2b195 100644 --- a/py/libs/loader.py +++ b/py/libs/loader.py @@ -486,7 +486,6 @@ class easyLoader: else: from ..kolors.loader import applyKolorsUnet with applyKolorsUnet(): - unet_path = folder_paths.get_full_path("unet", unet_name) sd = comfy.utils.load_torch_file(unet_path) model = comfy.sd.load_unet_state_dict(sd) diff --git a/py/libs/utils.py b/py/libs/utils.py index e54543d..b877489 100644 --- a/py/libs/utils.py +++ b/py/libs/utils.py @@ -5,6 +5,19 @@ class AlwaysEqualProxy(str): def __ne__(self, _): return False +class TautologyStr(str): + def __ne__(self, other): + return False + +class ByPassTypeTuple(tuple): + def __getitem__(self, index): + if index>0: + index=0 + item = super().__getitem__(index) + if isinstance(item, str): + return TautologyStr(item) + return item + comfy_ui_revision = None def get_comfyui_revision(): try: diff --git a/py/libs/xyplot.py b/py/libs/xyplot.py index f5f64fe..e302b7d 100644 --- a/py/libs/xyplot.py +++ b/py/libs/xyplot.py @@ -394,7 +394,7 @@ class easyXYPlot(): model, clip, vae, clip_vision = self.easyCache.load_checkpoint(plot_image_vars['ckpt_name']) if plot_image_vars['lora_name'] != "None": - lora = {"lora_name": plot_image_vars['lora_name'], "model": model, "clip": clip, "model_strength": plot_image_vars['model_strength'], "clip_strength": plot_image_vars['lora_clip_strength']} + lora = {"lora_name": plot_image_vars['lora_name'], "model": model, "clip": clip, "model_strength": plot_image_vars['lora_model_strength'], "clip_strength": plot_image_vars['lora_clip_strength']} model, clip = self.easyCache.load_lora(lora) # Check for custom VAE diff --git a/py/logic.py b/py/logic.py index e47cc14..9809203 100644 --- a/py/logic.py +++ b/py/logic.py @@ -1,7 +1,7 @@ from typing import Iterator, List, Tuple, Dict, Any, Union, Optional from _decimal import Context, getcontext from decimal import Decimal -from .libs.utils import AlwaysEqualProxy, cleanGPUUsedForce +from .libs.utils import AlwaysEqualProxy, ByPassTypeTuple, cleanGPUUsedForce from .libs.cache import remove_cache import numpy as np import json @@ -424,19 +424,18 @@ class ConvertAnything: @classmethod def INPUT_TYPES(s): return {"required": { - "anything": (AlwaysEqualProxy("*"),), + "*": (AlwaysEqualProxy("*"),), "output_type": (["string", "int", "float", "boolean"], {"default": "string"}), }} - RETURN_TYPES = (AlwaysEqualProxy("*"),), - RETURN_NAMES = ('*',) + RETURN_TYPES = ByPassTypeTuple((AlwaysEqualProxy("*"),)) OUTPUT_NODE = True FUNCTION = "convert" CATEGORY = "EasyUse/Logic" def convert(self, *args, **kwargs): print(kwargs) - anything = kwargs['anything'] + anything = kwargs['*'] output_type = kwargs['output_type'] params = None if output_type == 'string': diff --git a/web/js/easy/easyDynamicWidgets.js b/web/js/easy/easyDynamicWidgets.js index 1dfdfef..ebd875c 100644 --- a/web/js/easy/easyDynamicWidgets.js +++ b/web/js/easy/easyDynamicWidgets.js @@ -1176,22 +1176,15 @@ app.registerExtension({ if(nodeData.name == 'easy convertAnything'){ const onNodeCreated = nodeType.prototype.onNodeCreated; - const changeType = async function (type) { - const body = new FormData(); - body.append("type", type); - const response = await api.fetchApi("/easyuse/convert", { method:'POST',body}); - } nodeType.prototype.onNodeCreated = async function () { onNodeCreated ? onNodeCreated.apply(this, []) : undefined; setTimeout(_=>{ const type_control = this.widgets[this.widgets.findIndex((w) => w.name === "output_type")] let _this = this - changeType(type_control.value) type_control.callback = async() => { _this.outputs[0].type = (type_control.value).toUpperCase() _this.outputs[0].name = type_control.value _this.outputs[0].label = type_control.value - changeType(type_control.value) } },300)