Skip to content

Commit 641f477

Browse files
Add a ManualSigmas node.
Can be used to manually set the sigmas for a model. This node accepts a list of integer and floating point numbers separated with any non numeric character.
1 parent 4f067b0 commit 641f477

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

comfy_extras/nodes_custom_sampler.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import node_helpers
1010
from typing_extensions import override
1111
from comfy_api.latest import ComfyExtension, io
12+
import re
1213

1314

1415
class BasicScheduler(io.ComfyNode):
@@ -1013,6 +1014,25 @@ def execute(cls, model, noise, sigmas, latent_image) -> io.NodeOutput:
10131014

10141015
add_noise = execute
10151016

1017+
class ManualSigmas(io.ComfyNode):
1018+
@classmethod
1019+
def define_schema(cls):
1020+
return io.Schema(
1021+
node_id="ManualSigmas",
1022+
category="_for_testing/custom_sampling",
1023+
is_experimental=True,
1024+
inputs=[
1025+
io.String.Input("sigmas", default="1, 0.5", multiline=False)
1026+
],
1027+
outputs=[io.Sigmas.Output()]
1028+
)
1029+
1030+
@classmethod
1031+
def execute(cls, sigmas) -> io.NodeOutput:
1032+
sigmas = re.findall(r"[-+]?(?:\d*\.*\d+)", sigmas)
1033+
sigmas = [float(i) for i in sigmas]
1034+
sigmas = torch.FloatTensor(sigmas)
1035+
return io.NodeOutput(sigmas)
10161036

10171037
class CustomSamplersExtension(ComfyExtension):
10181038
@override
@@ -1052,6 +1072,7 @@ async def get_node_list(self) -> list[type[io.ComfyNode]]:
10521072
DisableNoise,
10531073
AddNoise,
10541074
SamplerCustomAdvanced,
1075+
ManualSigmas,
10551076
]
10561077

10571078

0 commit comments

Comments
 (0)