Comfy-Org / Comfy-Org/ComfyUI

How to create a custom node that returns a sampler ?

Open
#2,234 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

Here is what I have right now:
```python
class BasicParameters:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, ),
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, ),
"steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
"hires_steps": ("INT", {"default": 20, "min": 1, "max": 10000}),
"cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01}),
}
}

RETURN_TYPES = ("COMBO,STRING", "COMBO, STRING", "INT", "INT", "FLOAT")
RETURN_NAMES = ("sampler_name", "scheduler_name", "steps", "hires steps", "cfg")
FUNCTION = "select"
CATEGORY = "sampling"

def select(self, sampler_name, scheduler_name, steps, hires_steps, cfg):
return (sampler_name, scheduler_name, steps, hires_steps, cfg)
```
I've tried to use `RETURN_TYPES = ("COMBO", ....)` instead of `"COMBO,STRING"`, but apparently, the frontend requires that extra `,STRING` in order to accept the connection.
But then, here is what I get when I'm trying to generate:
`Return type mismatch between linked nodes: sampler_name, COMBO,STRING != COMBO`

So, how do you do this properly ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.