add VAELoaderText

This commit is contained in:
lilly
2023-04-13 00:27:48 +09:00
parent fe13add535
commit 038ea91985
3 changed files with 47 additions and 1 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ class CheckpointLoaderSimpleText:
else:
(name,fullpath)=filenameget(os.path.join(models_dir, "checkpoints")+"/**/"+ckpt_name+"*.safetensors")
if fullpath is None:
print(f"{name} is none")
print(f"{ckpt_name} is none")
return
ckpt_path=fullpath
try:
+45
View File
@@ -0,0 +1,45 @@
import folder_paths
import comfy.sd
import os
from folder_paths import *
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
from ConsoleColor import print, console
from mypath import *
else:
from .ConsoleColor import print, console
from .mypath import *
class VAELoaderText:
@classmethod
def INPUT_TYPES(s):
return {"required": {
"vae_name": ("STRING", {
"multiline": False, #True if you want the field to look like the one on the ClipTextEncode node
"default": random.choice(folder_paths.get_filename_list("vae"))
}),
}}
RETURN_TYPES = ("VAE",)
FUNCTION = "load_vae"
CATEGORY = "loaders"
#TODO: scale factor?
def load_vae(self, vae_name):
if os.path.isabs(vae_name):
vae_path=vae_name
else:
if vae_name.endswith('.safetensors') or vae_name.endswith('.pt') :
vae_path = folder_paths.get_full_path("vae", vae_name)
if vae_path is None:
print(f"{vae_name} is none")
if vae_name.endswith(".safetensors") or vae_name.endswith(".pt"):
(name,fullpath)=filenameget(os.path.join(models_dir, "vae")+"/**/"+vae_name)
else:
(name,fullpath)=filenameget(os.path.join(models_dir, "vae")+"/**/"+vae_name+"*.safetensors")
if fullpath is None:
print(f"{vae_name} is none")
return
vae_path=fullpath
vae = comfy.sd.VAE(ckpt_path=vae_path)
return (vae,)
+1
View File
@@ -93,6 +93,7 @@ if __name__ == "ComfyUI_node_Lilly" :
add("LoraLoaderTextRandom")
add("Random_Sampler")
add("VAELoaderDecode")
add("VAELoaderText")
add("SimpleSampler",["SimpleSampler","SimpleSamplerVAE"])
add("SaveImageSimple")
add("TextWildcards")