diff --git a/jps_nodes.py b/jps_nodes.py index 881e09f..3810d5d 100644 --- a/jps_nodes.py +++ b/jps_nodes.py @@ -4,6 +4,7 @@ #------------------------------------------------------------------------# import comfy.sd +from datetime import datetime accepted_ratios_horizontal = { "12:5": (1536, 640, 2.400000000), @@ -84,6 +85,7 @@ class SDXL_Resolutions: class SDXL_Basic_Settings: resolution = ["square - 1024x1024 (1:1)","landscape - 1152x896 (4:3)","landscape - 1216x832 (3:2)","landscape - 1344x768 (16:9)","landscape - 1536x640 (21:9)", "portrait - 896x1152 (3:4)","portrait - 832x1216 (2:3)","portrait - 768x1344 (9:16)","portrait - 640x1536 (9:21)"] + vaefrom = ["Separate VAE","Base Model VAE","Refiner Model VAE"] def __init__(self): pass @@ -95,21 +97,23 @@ class SDXL_Basic_Settings: "resolution": (s.resolution,), "sampler_name": (comfy.samplers.KSampler.SAMPLERS,), "scheduler": (comfy.samplers.KSampler.SCHEDULERS,), + "vae_source": (s.vaefrom,), "steps_total": ("INT", {"default": 60, "min": 20, "max": 250, "step": 5}), "base_percentage": ("INT", {"default": 80, "min": 5, "max": 100, "step": 5}), "cfg_base": ("FLOAT", {"default": 7, "min": 1, "max": 20, "step": 0.1}), "cfg_refiner": ("FLOAT", {"default": 0, "min": 0, "max": 20, "step": 0.1}), "ascore_refiner": ("FLOAT", {"default": 6, "min": 1, "max": 10, "step": 0.1}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), - "filename_prefix": ("STRING", {"default": "JPS"}), + "clip_skip_base": ("INT", {"default": -1, "min": -24, "max": -1}), + "clip_skip_refiner": ("INT", {"default": -1, "min": -24, "max": -1}), + "filename": ("STRING", {"default": "JPS"}), }} - RETURN_TYPES = ("INT","INT",comfy.samplers.KSampler.SAMPLERS,comfy.samplers.KSampler.SCHEDULERS,"INT","INT","FLOAT","FLOAT","FLOAT","INT","STRING") - RETURN_NAMES = ("width", "height", "sampler_name", "scheduler", "steps_total", "step_split","cfg_base","cfg_refiner","ascore_refiner","seed","filename_prefix") + RETURN_TYPES = ("INT","INT",comfy.samplers.KSampler.SAMPLERS,comfy.samplers.KSampler.SCHEDULERS,"INT","INT","INT","FLOAT","FLOAT","FLOAT","INT","INT","STRING") + RETURN_NAMES = ("width", "height", "sampler_name", "scheduler", "vae_select", "steps_total", "step_split","cfg_base","cfg_refiner","ascore_refiner","clip_skip_base","clip_skip_refiner","filename") FUNCTION = "get_values" CATEGORY="JPS Nodes/SDXL" - def get_values(self,resolution,sampler_name,scheduler,steps_total,base_percentage,cfg_base,cfg_refiner,ascore_refiner,seed,filename_prefix): + def get_values(self,resolution,sampler_name,scheduler,vae_source,steps_total,base_percentage,cfg_base,cfg_refiner,ascore_refiner,clip_skip_base,clip_skip_refiner,filename): width = 1024 height = 1024 width = int(width) @@ -120,6 +124,7 @@ class SDXL_Basic_Settings: cfg_refiner = float (cfg_refiner) ascore_refiner = float (ascore_refiner) base_percentage = int (base_percentage) + if(resolution == "square - 1024x1024 (1:1)"): width = 1024 height = 1024 @@ -147,40 +152,17 @@ class SDXL_Basic_Settings: if(resolution == "portrait - 640x1536 (9:21)"): width = 640 height = 1536 + if(cfg_refiner == 0): cfg_refiner = cfg_base + + vae_select = 1 + if(vae_source == "Base Model VAE"): + vae_select = 2 + if(vae_source == "Refiner Model VAE"): + vae_select = 3 - return(int(width),int(height),sampler_name,scheduler,int(steps_total),int(step_split),float(cfg_base),float(cfg_refiner),float(ascore_refiner),int(seed),str(filename_prefix)) - -#---------------------------------------------------------------------------------------------------------------------------------------------------# - -class SDXL_Additional_Settings: - - def __init__(self): - pass - - @classmethod - def INPUT_TYPES(s): - return { - "required": { - "offset_percentage": ("INT", {"default": 50, "min": -200, "max": 200, "step": 5}), - "upscale_total_steps": ("INT", {"default": 50, "min": 10, "max": 100, "step": 5}), - "upscale_percentage": ("INT", {"default": 33, "min": 0, "max": 100, "step": 5}), - "facefix_percentage": ("INT", {"default": 15, "min": 0, "max": 100, "step": 5}), - }} - RETURN_TYPES = ("FLOAT","INT","INT","FLOAT") - RETURN_NAMES = ("offset_strength", "upscale_total_steps", "upscale_start_step", "facefix_strength") - FUNCTION = "get_addvalues" - - CATEGORY="JPS Nodes/SDXL" - - def get_addvalues(self,offset_percentage,upscale_total_steps,upscale_percentage,facefix_percentage): - offset_strength = int(offset_percentage) / 100 - upscale_total_steps = int(upscale_total_steps) - upscale_start_step = int(upscale_total_steps) * (100 - upscale_percentage) / 100 - facefix_strength = int(facefix_percentage) / 100 - - return(float(offset_strength),int(upscale_total_steps),int(upscale_start_step),float(facefix_strength)) + return(int(width),int(height),sampler_name,scheduler,int(vae_select),int(steps_total),int(step_split),float(cfg_base),float(cfg_refiner),float(ascore_refiner),int(clip_skip_base),int(clip_skip_refiner),str(filename)) #---------------------------------------------------------------------------------------------------------------------------------------------------# @@ -359,6 +341,39 @@ class Math_Substract_INT_INT: #---------------------------------------------------------------------------------------------------------------------------------------------------# +class Get_Date_Time_String: + time_format = ["%Y%m%d%H%M%S","%Y%m%d%H%M","%Y%m%d","%Y-%m-%d-%H_%M_%S","%Y-%m-%d-%H_%M","%Y-%m-%d","%Y-%m-%d %H_%M_%S","%Y-%m-%d %H_%M","%Y-%m-%d"] + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "style": (s.time_format,), + } + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("time_format",) + FUNCTION = "get_time" + + CATEGORY = "JPS Nodes/Filename" + + def get_time(self, style): + now = datetime.now() + timestamp = now.strftime(style) + + return (timestamp,) + + @classmethod + def IS_CHANGED(s, style): + now = datetime.now() + timestamp = now.strftime(style) + return (timestamp,) + +#---------------------------------------------------------------------------------------------------------------------------------------------------# + class SDXL_Recommended_Resolution_Calc: def __init__(self): @@ -713,7 +728,6 @@ class Menu_Enable_Disable: NODE_CLASS_MAPPINGS = { "SDXL Resolutions (JPS)": SDXL_Resolutions, "SDXL Basic Settings (JPS)": SDXL_Basic_Settings, - "SDXL Additional Settings (JPS)": SDXL_Additional_Settings, "SDXL Recommended Resolution Calc (JPS)": SDXL_Recommended_Resolution_Calc, "Math Resolution Multiply (JPS)": Math_Resolution_Multiply, "Math Largest Int (JPS)": Math_Largest_Integer, @@ -728,4 +742,5 @@ NODE_CLASS_MAPPINGS = { "Menu Sampler Scheduler (JPS)": Menu_Sampler_Scheduler, "Menu Disable Enable Switch (JPS)": Menu_Disable_Enable, "Menu Enable Disable Switch (JPS)": Menu_Enable_Disable, + "Filename Get Date Time String (JPS)": Get_Date_Time_String, }