alexopus / ComfyUI-Image-Saver

Save images with Civitai-compatible generation metadata in ComfyUI
MIT License
49 stars 8 forks source link

AYS scheduler addition causes SchedulerSelector to not link to KSampler.sampler_name #22

Closed jhillacre closed 5 months ago

jhillacre commented 5 months ago

When using SchedulerSelector and ImageSaver with the default KSampler node's scheduler widget turned input, I cannot connect SchedulerSelector.scheduler to KSampler.scheduler.

When I removed the addition of AYS* schedulers in your node.py, I'm able to connect the nodes.

diff --git a/nodes.py b/nodes.py
index d3f2cee..5dd2913 100644
--- a/nodes.py
+++ b/nodes.py
@@ -171,13 +171,13 @@ class SamplerSelector:

 class SchedulerSelector:
     CATEGORY = 'ImageSaver/utils'
-    RETURN_TYPES = (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD'],)
+    RETURN_TYPES = (comfy.samplers.KSampler.SCHEDULERS,)
     RETURN_NAMES = ("scheduler",)
     FUNCTION = "get_names"

     @classmethod
     def INPUT_TYPES(cls):
-        return {"required": {"scheduler": (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD'],)}}
+        return {"required": {"scheduler": (comfy.samplers.KSampler.SCHEDULERS,)}}

     def get_names(self, scheduler):
         return (scheduler,)
@@ -235,7 +235,7 @@ class ImageSaver:
                 "cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0}),
                 "modelname": ("STRING", {"default": '', "multiline": False}),
                 "sampler_name": (comfy.samplers.KSampler.SAMPLERS,),
-                "scheduler": (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD'],),
+                "scheduler": (comfy.samplers.KSampler.SCHEDULERS,),
             },
             "optional": {
                 "positive": ("STRING", {"default": 'unknown', "multiline": True}),

I'm new to ComfyUI, but it seems that they don't want to allow lists of different values anymore.

I'm using ComfyUI @ https://github.com/comfyanonymous/ComfyUI/commit/ffc4b7c30e35eb2773ace52a0b00e0ca5c1f4362 and ComfyUI-Image-Saver @ https://github.com/alexopus/ComfyUI-Image-Saver/commit/a98005bd463fcf440629f2d59f0c6816f207bd81

alexopus commented 5 months ago

Hmm, I see. I've been using KSampler from the inspire pack, which deals with this fine. Need to think what a good solution would be.

jhillacre commented 5 months ago

You could add some conversion nodes similar to the default rerouters:

Alternatively, you could make your selector node output three types on the same value in different formats. If 'AYS SDXL' is selected, the default typed value could be None. This feels similar to how you have "Checkpoint Loader with Name (Image Saver)" working.

alexopus commented 5 months ago

It is now fixed in the main. Saver nodes accepts scheduler as a STRING. There are now SchedulerSelector and SchedulerSelectorComfy. Former outputs same type as before (same list as in the inspire pack), latter the "normal" Comfy scheduler types. Additionally, both also output a string with the selected scheduler name, which can be routed to the Saver.

alexopus commented 5 months ago

Also added scheduler to string converters, in case you're getting those from somewhere else.