giriss / comfy-image-saver

All the tools you need to save images with their generation metadata on ComfyUI. Compatible with Civitai & Prompthero geninfo auto-detection. Works with png, jpeg and webp.
MIT License
188 stars 32 forks source link

Connecting the sampler_name, scheduler_name and model_name nodes to KSampler throws errors. #20

Open sawasy opened 7 months ago

sawasy commented 7 months ago
Return type mismatch between linked nodes: sampler_name, ['euler', 'euler_ancestral', 'heun', 'heunpp2', 'dpm_2', 'dpm_2_ancestral', 'lms', 'dpm_fast', 'dpm_adaptive', 'dpmpp_2s_ancestral', 'dpmpp_sde', 'dpmpp_sde_gpu', 'dpmpp_2m', 'dpmpp_2m_sde', 'dpmpp_2m_sde_gpu', 'dpmpp_3m_sde', 'dpmpp_3m_sde_gpu', 'ddpm', 'lcm', 'ddim', 'uni_pc', 'uni_pc_bh2'] != COMBO

This is the same with scheduler_name and model_name nodes.

m!

water2891 commented 5 months ago

Referring to my code below, modify the nodes.py file. sampler_name, scheduler_name can be modified like this

class SamplerSelector:
    CATEGORY = 'ImageSaver/utils'
    RETURN_TYPES = ("COMBO",)    # <--fix here
    RETURN_NAMES = ("sampler_name",)
    FUNCTION = "get_names"

    @classmethod
    def INPUT_TYPES(cls):
        return {"required": {"sampler_name": (comfy.samplers.KSampler.SAMPLERS,)}}

    def get_names(self, sampler_name):
        return ([sampler_name],)    # <--and here: return an array