comfy-image-saver icon indicating copy to clipboard operation
comfy-image-saver copied to clipboard

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

Open sawasy opened this issue 1 year ago • 2 comments

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!

sawasy avatar Mar 11 '24 10:03 sawasy

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

water2891 avatar Apr 20 '24 13:04 water2891

There appears to be a bit more to this.

If I connect it to KSampler, select "Auto Queue" in Comfy, and then click "Queue Prompt" it works and it works forever apparently.

But the moment I don't have "Auto Queue" enabled, and I click "Queue Prompt" multiple times...then it throws the error.

There's some sort of validation that happens when you queue up multiple runs that doesn't happen when there's only one item in the queue at a time.

darkpixel avatar Nov 01 '24 14:11 darkpixel