Fix basic xyplot lora load error #257

This commit is contained in:
yolain
2024-07-16 17:35:53 +08:00
parent c68258304c
commit 8a272004dd
6 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -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")
-1
View File
@@ -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)
+13
View File
@@ -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:
+1 -1
View File
@@ -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
+4 -5
View File
@@ -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':
-7
View File
@@ -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)