Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions comfy_extras/nodes_chroma_radiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ def define_schema(cls) -> io.Schema:
io.Int.Input(id="height", default=1024, min=16, max=nodes.MAX_RESOLUTION, step=16),
io.Int.Input(id="batch_size", default=1, min=1, max=4096),
],
outputs=[io.Latent().Output()],
outputs=[
io.Latent().Output(),
io.Int.Output(display_name="width"),
io.Int.Output(display_name="height"),
],
)

@classmethod
def execute(cls, *, width: int, height: int, batch_size: int=1) -> io.NodeOutput:
latent = torch.zeros((batch_size, 3, height, width), device=comfy.model_management.intermediate_device())
return io.NodeOutput({"samples":latent})
return io.NodeOutput({"samples":latent}, width, height)


class ChromaRadianceOptions(io.ComfyNode):
Expand Down
8 changes: 6 additions & 2 deletions comfy_extras/nodes_cosmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ def define_schema(cls) -> io.Schema:
io.Int.Input("length", default=121, min=1, max=nodes.MAX_RESOLUTION, step=8),
io.Int.Input("batch_size", default=1, min=1, max=4096),
],
outputs=[io.Latent.Output()],
outputs=[
io.Latent.Output(),
io.Int.Output(display_name="width"),
io.Int.Output(display_name="height"),
],
)

@classmethod
def execute(cls, width, height, length, batch_size=1) -> io.NodeOutput:
latent = torch.zeros([batch_size, 16, ((length - 1) // 8) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
return io.NodeOutput({"samples": latent})
return io.NodeOutput({"samples": latent}, width, height)


def vae_encode_with_padding(vae, image, width, height, length, padding=0):
Expand Down
4 changes: 3 additions & 1 deletion comfy_extras/nodes_lt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ def define_schema(cls):
],
outputs=[
io.Latent.Output(),
io.Int.Output(display_name="width"),
io.Int.Output(display_name="height"),
],
)

@classmethod
def execute(cls, width, height, length, batch_size=1) -> io.NodeOutput:
latent = torch.zeros([batch_size, 128, ((length - 1) // 8) + 1, height // 32, width // 32], device=comfy.model_management.intermediate_device())
return io.NodeOutput({"samples": latent})
return io.NodeOutput({"samples": latent}, width, height)


class LTXVImgToVideo(io.ComfyNode):
Expand Down
4 changes: 3 additions & 1 deletion comfy_extras/nodes_mochi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ def define_schema(cls):
],
outputs=[
io.Latent.Output(),
io.Int.Output(display_name="width"),
io.Int.Output(display_name="height"),
],
)

@classmethod
def execute(cls, width, height, length, batch_size=1) -> io.NodeOutput:
latent = torch.zeros([batch_size, 12, ((length - 1) // 6) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
return io.NodeOutput({"samples": latent})
return io.NodeOutput({"samples": latent}, width, height)


class MochiExtension(ComfyExtension):
Expand Down
6 changes: 4 additions & 2 deletions comfy_extras/nodes_sd3.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ def INPUT_TYPES(s):
return {"required": { "width": ("INT", {"default": 1024, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}),
"height": ("INT", {"default": 1024, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}),
"batch_size": ("INT", {"default": 1, "min": 1, "max": 4096})}}
RETURN_TYPES = ("LATENT",)
RETURN_TYPES = ("LATENT", "INT", "INT")
RETURN_NAMES = ("LATENT", "width", "height")
OUTPUT_TOOLTIPS = ("The empty latent image batch.", "The width of the latent images.", "The height of the latent images.")
FUNCTION = "generate"

CATEGORY = "latent/sd3"

def generate(self, width, height, batch_size=1):
latent = torch.zeros([batch_size, 16, height // 8, width // 8], device=self.device)
return ({"samples":latent}, )
return ({"samples":latent}, width, height)


class CLIPTextEncodeSD3:
Expand Down
6 changes: 5 additions & 1 deletion comfy_extras/nodes_stable_cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def define_schema(cls):
outputs=[
io.Latent.Output(display_name="stage_c"),
io.Latent.Output(display_name="stage_b"),
io.Int.Output(display_name="width"),
io.Int.Output(display_name="height"),
],
)

Expand All @@ -50,7 +52,9 @@ def execute(cls, width, height, compression, batch_size=1):
"samples": c_latent,
}, {
"samples": b_latent,
})
},
width,
height)


class StableCascade_StageC_VAEEncode(io.ComfyNode):
Expand Down
7 changes: 4 additions & 3 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,16 +1174,17 @@ def INPUT_TYPES(s):
"batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."})
}
}
RETURN_TYPES = ("LATENT",)
OUTPUT_TOOLTIPS = ("The empty latent image batch.",)
RETURN_TYPES = ("LATENT", "INT", "INT")
RETURN_NAMES = ("LATENT", "width", "height")
OUTPUT_TOOLTIPS = ("The empty latent image batch.", "The width of the latent images.", "The height of the latent images.")
FUNCTION = "generate"

CATEGORY = "latent"
DESCRIPTION = "Create a new batch of empty latent images to be denoised via sampling."

def generate(self, width, height, batch_size=1):
latent = torch.zeros([batch_size, 4, height // 8, width // 8], device=self.device)
return ({"samples":latent}, )
return ({"samples":latent}, width, height)


class LatentFromBatch:
Expand Down
6 changes: 5 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from comfy.cli_args import args
import comfy.utils
import comfy.model_management
from comfy.samplers import SAMPLER_NAMES
from comfy_api import feature_flags
import node_helpers
from comfyui_version import __version__
Expand Down Expand Up @@ -286,6 +287,10 @@ async def get_extensions(request):

return web.json_response(extensions)

@routes.get("/samplers")
def get_samplers(request):
return web.json_response(sorted(SAMPLER_NAMES))

def get_dir_by_type(dir_type):
if dir_type is None:
dir_type = "input"
Expand Down Expand Up @@ -366,7 +371,6 @@ async def upload_image(request):
post = await request.post()
return image_upload(post)


@routes.post("/upload/mask")
async def upload_mask(request):
post = await request.post()
Expand Down