seed wildcards
This commit is contained in:
@@ -18,7 +18,11 @@ else:
|
|||||||
class CLIPTextEncodeWildcards:
|
class CLIPTextEncodeWildcards:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {"required": {"text": ("STRING", {"multiline": True}), "clip": ("CLIP", )}}
|
return {
|
||||||
|
"required": {
|
||||||
|
"text": ("STRING", {"multiline": True}), "clip": ("CLIP", )
|
||||||
|
}
|
||||||
|
}
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
RETURN_TYPES = ("CONDITIONING",)
|
||||||
FUNCTION = "encode"
|
FUNCTION = "encode"
|
||||||
|
|
||||||
@@ -28,3 +32,24 @@ class CLIPTextEncodeWildcards:
|
|||||||
r=wildcards.run(text)
|
r=wildcards.run(text)
|
||||||
print(f"[green]encode : [/green]",r)
|
print(f"[green]encode : [/green]",r)
|
||||||
return ([[clip.encode(r), {}]], )
|
return ([[clip.encode(r), {}]], )
|
||||||
|
|
||||||
|
class CLIPTextEncodeWildcards2:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"text": ("STRING", {"multiline": True}), "clip": ("CLIP", ),
|
||||||
|
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RETURN_TYPES = ("CONDITIONING",)
|
||||||
|
FUNCTION = "encode"
|
||||||
|
|
||||||
|
CATEGORY = "conditioning"
|
||||||
|
|
||||||
|
def encode(self, seed, clip, text):
|
||||||
|
random.seed(seed)
|
||||||
|
r=wildcards.run(text)
|
||||||
|
print(f"[green]encode : [/green]",r)
|
||||||
|
return ([[clip.encode(r), {}]], )
|
||||||
|
|||||||
+5
-3
@@ -44,11 +44,13 @@ if not md.startswith("custom_nodes."):
|
|||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
def add(name):
|
def add(name,list=None):
|
||||||
#print(f"Load : {name}")
|
#print(f"Load : {name}")
|
||||||
try:
|
try:
|
||||||
pkg = importlib.import_module(f"{md}.{name}")
|
pkg = importlib.import_module(f"{md}.{name}")
|
||||||
NODE_CLASS_MAPPINGS[name]=eval(f"pkg.{name}")
|
NODE_CLASS_MAPPINGS[name]=eval(f"pkg.{name}")
|
||||||
|
if type(list) is str:
|
||||||
|
NODE_CLASS_MAPPINGS[list]=eval(f"pkg.{list}")
|
||||||
print(f"Load ok : {name}", style="bold green")
|
print(f"Load ok : {name}", style="bold green")
|
||||||
except Exception:
|
except Exception:
|
||||||
console.print_exception()
|
console.print_exception()
|
||||||
@@ -57,7 +59,7 @@ if not md.startswith("custom_nodes."):
|
|||||||
|
|
||||||
add("CheckpointLoaderRandom")
|
add("CheckpointLoaderRandom")
|
||||||
add("CheckpointLoaderSimpleText")
|
add("CheckpointLoaderSimpleText")
|
||||||
add("CLIPTextEncodeWildcards")
|
add("CLIPTextEncodeWildcards","CLIPTextEncodeWildcards2")
|
||||||
add("LoraLoaderText")
|
add("LoraLoaderText")
|
||||||
add("LoraLoaderTextRandom")
|
add("LoraLoaderTextRandom")
|
||||||
add("Random_Sampler")
|
add("Random_Sampler")
|
||||||
@@ -66,4 +68,4 @@ if not md.startswith("custom_nodes."):
|
|||||||
add("SaveImageSimple")
|
add("SaveImageSimple")
|
||||||
#add("test")
|
#add("test")
|
||||||
|
|
||||||
console.rule(" finit end ", style="bold green")
|
console.rule(" init end ", style="bold green")
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
import ast
|
||||||
import os
|
import os
|
||||||
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
|
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
|
||||||
from ConsoleColor import print, console
|
from ConsoleColor import print, console
|
||||||
else:
|
else:
|
||||||
from .ConsoleColor import print, console
|
from .ConsoleColor import print, console
|
||||||
#print(__file__)
|
|
||||||
#print(os.path.basename(__file__))
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import psutil
|
import psutil
|
||||||
@@ -47,23 +45,3 @@ mainFile = os.path.abspath(sys.modules['__main__'].__file__)
|
|||||||
print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style="bold CYAN")
|
print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style="bold CYAN")
|
||||||
mainfolder = os.path.dirname(mainFile)
|
mainfolder = os.path.dirname(mainFile)
|
||||||
print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN")
|
print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN")
|
||||||
|
|
||||||
def jsondic(full,dic,update=False):
|
|
||||||
|
|
||||||
path=os.path.split(full)[0]
|
|
||||||
if not os.path.exists(path):
|
|
||||||
os.makedirs(path)
|
|
||||||
#with open(f"./RandomLoop/chars-{time.strftime('_%Y%m%d_%H%M%S')}.json", 'w', encoding='utf-8') as file:
|
|
||||||
if os.path.exists(full):
|
|
||||||
with open(full, 'r', encoding='utf-8') as file:
|
|
||||||
tmp=json.load(file)
|
|
||||||
if update:
|
|
||||||
dic.update(tmp)
|
|
||||||
else:
|
|
||||||
dic=(tmp)
|
|
||||||
else:
|
|
||||||
with open(full, 'w', encoding='utf-8') as file:
|
|
||||||
json.dump(dic, file, sort_keys=False, indent=4)
|
|
||||||
|
|
||||||
return path
|
|
||||||
|
|
||||||
+3
-3
@@ -166,7 +166,7 @@ class wildcards:
|
|||||||
#print(__name__)
|
#print(__name__)
|
||||||
#if __name__ == '__main__' :
|
#if __name__ == '__main__' :
|
||||||
# 테스트용
|
# 테스트용
|
||||||
test="{3$$a1|{b2|c3|}|d4|{-$$|f|g}|{-2$$h||i}|{1-$$j|k|}}/{$$l|m|}/{0$$n|}"
|
#test="{3$$a1|{b2|c3|}|d4|{-$$|f|g}|{-2$$h||i}|{1-$$j|k|}}/{$$l|m|}/{0$$n|}"
|
||||||
print("[green]wildcards test : [/green]",wildcards.run(test))
|
#print("[green]wildcards test : [/green]",wildcards.run(test))
|
||||||
#print("wildcards test : "+wildcards.run("{9$$a|b}"))
|
#print("wildcards test : "+wildcards.run("{9$$a|b}"))
|
||||||
print("[green]wildcards test : [/green]",wildcards.run("__my__"))
|
#print("[green]wildcards test : [/green]",wildcards.run("__my__"))
|
||||||
|
|||||||
Reference in New Issue
Block a user