Skip to content

Commit 3dd8bea

Browse files
committed
Add unified scheduler selector
1 parent 1c0ab65 commit 3dd8bea

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .nodes import ImageSaver, ImageSaverSimple, ImageSaverMetadata
44
from .nodes_literals import SeedGenerator, StringLiteral, SizeLiteral, IntLiteral, FloatLiteral, CfgLiteral
55
from .nodes_loaders import CheckpointLoaderWithName, UNETLoaderWithName
6-
from .nodes_selectors import SamplerSelector, SchedulerSelector, SchedulerSelectorComfy, SchedulerToString, SamplerToString, SchedulerComfyToString, InputParameters
6+
from .nodes_selectors import SamplerSelector, SchedulerSelector, SchedulerSelectorInspire, SchedulerToString, SamplerToString, SchedulerInspireToString, InputParameters
77
from .civitai_nodes import CivitaiHashFetcher
88

99
NODE_CLASS_MAPPINGS: dict[str, Any] = {
@@ -14,7 +14,8 @@
1414
"Image Saver Metadata": ImageSaverMetadata,
1515
"Sampler Selector (Image Saver)": SamplerSelector,
1616
"Scheduler Selector (Image Saver)": SchedulerSelector,
17-
"Scheduler Selector (Comfy) (Image Saver)": SchedulerSelectorComfy,
17+
"Scheduler Selector (inspire) (Image Saver)": SchedulerSelectorInspire,
18+
"Scheduler Selector (Image Saver)": SchedulerSelector,
1819
"Input Parameters (Image Saver)": InputParameters,
1920
"Seed Generator (Image Saver)": SeedGenerator,
2021
"String Literal (Image Saver)": StringLiteral,
@@ -23,7 +24,7 @@
2324
"Int Literal (Image Saver)": IntLiteral,
2425
"Float Literal (Image Saver)": FloatLiteral,
2526
"SchedulerToString (Image Saver)": SchedulerToString,
26-
"SchedulerComfyToString (Image Saver)": SchedulerComfyToString,
27+
"SchedulerInspireToString (Image Saver)": SchedulerInspireToString,
2728
"SamplerToString (Image Saver)": SamplerToString,
2829
"Civitai Hash Fetcher (Image Saver)": CivitaiHashFetcher,
2930
}

nodes_selectors.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Any
12
import comfy.sd
23

34
class SamplerSelector:
@@ -10,54 +11,54 @@ class SamplerSelector:
1011
DESCRIPTION = 'Provides one of the available ComfyUI samplers'
1112

1213
@classmethod
13-
def INPUT_TYPES(cls):
14+
def INPUT_TYPES(cls) -> dict[str, Any]:
1415
return {
1516
"required": {
1617
"sampler_name": (comfy.samplers.KSampler.SAMPLERS, {"tooltip": "sampler (Comfy's standard)"}),
1718
}
1819
}
1920

20-
def get_names(self, sampler_name):
21+
def get_names(self, sampler_name: str) -> tuple[str, str]:
2122
return (sampler_name, sampler_name)
2223

2324
class SchedulerSelector:
24-
RETURN_TYPES = (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]'], "STRING")
25-
RETURN_NAMES = ("scheduler", "scheduler_name")
26-
OUTPUT_TOOLTIPS = ("scheduler (SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]'])", "scheduler name (STRING)")
25+
RETURN_TYPES = (comfy.samplers.KSampler.SCHEDULERS, "STRING")
26+
RETURN_NAMES = ("scheduler", "scheduler_name")
27+
OUTPUT_TOOLTIPS = ("scheduler (SCHEDULERS)", "scheduler name (STRING)")
2728
FUNCTION = "get_names"
2829

2930
CATEGORY = 'ImageSaver/utils'
30-
DESCRIPTION = 'Provides one of the standard ComfyUI plus some extra schedulers'
31+
DESCRIPTION = 'Provides one of the standard KSampler schedulers'
3132

3233
@classmethod
33-
def INPUT_TYPES(cls):
34+
def INPUT_TYPES(cls) -> dict[str, Any]:
3435
return {
3536
"required": {
36-
"scheduler": (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]'], {"tooltip": "scheduler (Comfy's standard + extras)"}),
37+
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, {"tooltip": "scheduler (Comfy's standard)"}),
3738
}
3839
}
3940

40-
def get_names(self, scheduler):
41+
def get_names(self, scheduler: str) -> tuple[str, str]:
4142
return (scheduler, scheduler)
4243

43-
class SchedulerSelectorComfy:
44-
RETURN_TYPES = (comfy.samplers.KSampler.SCHEDULERS, "STRING")
45-
RETURN_NAMES = ("scheduler", "scheduler_name")
46-
OUTPUT_TOOLTIPS = ("scheduler (SCHEDULERS)", "scheduler name (STRING)")
44+
class SchedulerSelectorInspire:
45+
RETURN_TYPES = (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]', 'OSS FLUX', 'OSS Wan'], "STRING")
46+
RETURN_NAMES = ("scheduler", "scheduler_name")
47+
OUTPUT_TOOLTIPS = ("scheduler (SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]', 'OSS FLUX', 'OSS Wan'])", "scheduler name (STRING)")
4748
FUNCTION = "get_names"
4849

4950
CATEGORY = 'ImageSaver/utils'
50-
DESCRIPTION = 'Provides one of the standard ComfyUI schedulers'
51+
DESCRIPTION = 'Provides one of the KSampler (inspire) schedulers'
5152

5253
@classmethod
53-
def INPUT_TYPES(cls):
54+
def INPUT_TYPES(cls) -> dict[str, Any]:
5455
return {
5556
"required": {
56-
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, {"tooltip": "scheduler (Comfy's standard)"}),
57+
"scheduler": (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]', 'OSS FLUX', 'OSS Wan'], {"tooltip": "scheduler (Comfy's standard + extras)"}),
5758
}
5859
}
5960

60-
def get_names(self, scheduler):
61+
def get_names(self, scheduler: str) -> tuple[str, str]:
6162
return (scheduler, scheduler)
6263

6364
class SchedulerToString:
@@ -67,37 +68,37 @@ class SchedulerToString:
6768
FUNCTION = "get_name"
6869

6970
CATEGORY = 'ImageSaver/utils'
70-
DESCRIPTION = 'Provides a given sandard ComfyUI or some extra scheduler\'s name as string'
71+
DESCRIPTION = 'Provides a given sandard ComfyUI scheduler\'s name as string'
7172

7273
@classmethod
73-
def INPUT_TYPES(cls):
74+
def INPUT_TYPES(cls) -> dict[str, Any]:
7475
return {
7576
"required": {
76-
"scheduler": (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]'], {"tooltip": "scheduler (Comfy's standard + extras)"}),
77+
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, {"tooltip": "scheduler (KSampler)"}),
7778
}
7879
}
7980

80-
def get_name(self, scheduler):
81+
def get_name(self, scheduler: str) -> tuple[str,]:
8182
return (scheduler,)
8283

83-
class SchedulerComfyToString:
84+
class SchedulerInspireToString:
8485
RETURN_TYPES = ("STRING",)
8586
RETURN_NAMES = ("scheduler_name",)
8687
OUTPUT_TOOLTIPS = ("scheduler name (STRING)",)
8788
FUNCTION = "get_name"
8889

8990
CATEGORY = 'ImageSaver/utils'
90-
DESCRIPTION = 'Provides a given sandard ComfyUI scheduler\'s name as string'
91+
DESCRIPTION = 'Provides a given sandard ComfyUI or some extra scheduler\'s name as string'
9192

9293
@classmethod
93-
def INPUT_TYPES(cls):
94+
def INPUT_TYPES(cls) -> dict[str, Any]:
9495
return {
9596
"required": {
96-
"scheduler": (comfy.samplers.KSampler.SCHEDULERS, {"tooltip": "scheduler (Comfy's standard)"}),
97+
"scheduler": (comfy.samplers.KSampler.SCHEDULERS + ['AYS SDXL', 'AYS SD1', 'AYS SVD', 'GITS[coeff=1.2]', 'OSS FLUX', 'OSS Wan'], {"tooltip": "scheduler (KSampler inspire)"}),
9798
}
9899
}
99100

100-
def get_name(self, scheduler):
101+
def get_name(self, scheduler: str) -> tuple[str,]:
101102
return (scheduler,)
102103

103104
class SamplerToString:
@@ -110,14 +111,14 @@ class SamplerToString:
110111
DESCRIPTION = 'Provides a given sandard ComfyUI samplers\'s name as string'
111112

112113
@classmethod
113-
def INPUT_TYPES(cls):
114+
def INPUT_TYPES(cls) -> dict[str, Any]:
114115
return {
115116
"required": {
116117
"sampler": (comfy.samplers.KSampler.SAMPLERS, {"tooltip": "sampler (Comfy's standard)"}),
117118
}
118119
}
119120

120-
def get_name(self, sampler):
121+
def get_name(self, sampler: str) -> tuple[str,]:
121122
return (sampler,)
122123

123124
class InputParameters:
@@ -139,7 +140,7 @@ class InputParameters:
139140
DESCRIPTION = "Combined node for seed, steps, cfg, sampler, scheduler and denoise."
140141

141142
@classmethod
142-
def INPUT_TYPES(cls):
143+
def INPUT_TYPES(cls) -> dict[str, Any]:
143144
return {
144145
"required": {
145146
"seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "control_after_generate": True, "tooltip": "The random seed used for creating the noise."}),
@@ -151,5 +152,5 @@ def INPUT_TYPES(cls):
151152
}
152153
}
153154

154-
def get_values(self, seed, steps, cfg, sampler, scheduler, denoise):
155+
def get_values(self, seed: int, steps: int, cfg: float, sampler: str, scheduler: str, denoise: float) -> tuple[int, int, float, str, str, str, str, float]:
155156
return (seed, steps, cfg, sampler, sampler, scheduler, scheduler, denoise)

0 commit comments

Comments
 (0)