The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
convert nodes_gits.py to V3 schema (#9949)
Alexander Piskun7eb7160db487
diff --git a/comfy_extras/nodes_gits.py b/comfy_extras/nodes_gits.pyindex 47b1dd049..25367560a 100644--- a/comfy_extras/nodes_gits.py+++ b/comfy_extras/nodes_gits.py@@ -1,6 +1,8 @@# from https://github.com/zju-pi/diff-sampler/tree/main/gits-mainimport numpy as npimport torch+from typing_extensions import override+from comfy_api.latest import ComfyExtension, iodef loglinear_interp(t_steps, num_steps):"""@@ -333,25 +335,28 @@ NOISE_LEVELS = {],}-class GITSScheduler:+class GITSScheduler(io.ComfyNode):@classmethod- def INPUT_TYPES(s):- return {"required":- {"coeff": ("FLOAT", {"default": 1.20, "min": 0.80, "max": 1.50, "step": 0.05}),- "steps": ("INT", {"default": 10, "min": 2, "max": 1000}),- "denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),- }- }- RETURN_TYPES = ("SIGMAS",)- CATEGORY = "sampling/custom_sampling/schedulers"+ def define_schema(cls):+ return io.Schema(+ node_id="GITSScheduler",+ category="sampling/custom_sampling/schedulers",+ inputs=[+ io.Float.Input("coeff", default=1.20, min=0.80, max=1.50, step=0.05),+ io.Int.Input("steps", default=10, min=2, max=1000),+ io.Float.Input("denoise", default=1.0, min=0.0, max=1.0, step=0.01),+ ],+ outputs=[+ io.Sigmas.Output(),+ ],+ )- FUNCTION = "get_sigmas"-- def get_sigmas(self, coeff, steps, denoise):+ @classmethod+ def execute(cls, coeff, steps, denoise):total_steps = stepsif denoise < 1.0:if denoise <= 0.0:- return (torch.FloatTensor([]),)+ return io.NodeOutput(torch.FloatTensor([]))total_steps = round(steps * denoise)if steps <= 20:@@ -362,8 +367,16 @@ class GITSScheduler:sigmas = sigmas[-(total_steps + 1):]sigmas[-1] = 0- return (torch.FloatTensor(sigmas), )+ return io.NodeOutput(torch.FloatTensor(sigmas))-NODE_CLASS_MAPPINGS = {- "GITSScheduler": GITSScheduler,-}++class GITSSchedulerExtension(ComfyExtension):+ @override+ async def get_node_list(self) -> list[type[io.ComfyNode]]:+ return [+ GITSScheduler,+ ]+++async def comfy_entrypoint() -> GITSSchedulerExtension:+ return GITSSchedulerExtension()