2025-09-29 22:03:35 +03:00
|
|
|
from typing_extensions import override
|
2024-10-26 06:54:00 -04:00
|
|
|
import torch
|
|
|
|
|
import comfy.model_management
|
2025-09-29 22:03:35 +03:00
|
|
|
import nodes
|
|
|
|
|
from comfy_api.latest import ComfyExtension, io
|
2024-10-26 06:54:00 -04:00
|
|
|
|
|
|
|
|
|
2025-09-29 22:03:35 +03:00
|
|
|
class EmptyMochiLatentVideo(io.ComfyNode):
|
|
|
|
|
@classmethod
|
|
|
|
|
def define_schema(cls):
|
|
|
|
|
return io.Schema(
|
|
|
|
|
node_id="EmptyMochiLatentVideo",
|
2026-06-17 08:33:09 +08:00
|
|
|
category="model/latent/mochi",
|
2025-09-29 22:03:35 +03:00
|
|
|
inputs=[
|
|
|
|
|
io.Int.Input("width", default=848, min=16, max=nodes.MAX_RESOLUTION, step=16),
|
|
|
|
|
io.Int.Input("height", default=480, min=16, max=nodes.MAX_RESOLUTION, step=16),
|
|
|
|
|
io.Int.Input("length", default=25, min=7, max=nodes.MAX_RESOLUTION, step=6),
|
|
|
|
|
io.Int.Input("batch_size", default=1, min=1, max=4096),
|
|
|
|
|
],
|
|
|
|
|
outputs=[
|
|
|
|
|
io.Latent.Output(),
|
|
|
|
|
],
|
|
|
|
|
)
|
2024-10-26 06:54:00 -04:00
|
|
|
|
2025-09-29 22:03:35 +03:00
|
|
|
@classmethod
|
|
|
|
|
def execute(cls, width, height, length, batch_size=1) -> io.NodeOutput:
|
2024-11-08 08:33:44 -05:00
|
|
|
latent = torch.zeros([batch_size, 12, ((length - 1) // 6) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
|
2025-09-29 22:03:35 +03:00
|
|
|
return io.NodeOutput({"samples": latent})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MochiExtension(ComfyExtension):
|
|
|
|
|
@override
|
|
|
|
|
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
|
|
|
|
return [
|
|
|
|
|
EmptyMochiLatentVideo,
|
|
|
|
|
]
|
|
|
|
|
|
2024-10-26 06:54:00 -04:00
|
|
|
|
2025-09-29 22:03:35 +03:00
|
|
|
async def comfy_entrypoint() -> MochiExtension:
|
|
|
|
|
return MochiExtension()
|