|
1 |
| -import nodes |
| 1 | +from typing_extensions import override |
2 | 2 | import torch
|
3 | 3 | import comfy.model_management
|
| 4 | +import nodes |
| 5 | +from comfy_api.latest import ComfyExtension, io |
4 | 6 |
|
5 |
| -class EmptyMochiLatentVideo: |
6 |
| - @classmethod |
7 |
| - def INPUT_TYPES(s): |
8 |
| - return {"required": { "width": ("INT", {"default": 848, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), |
9 |
| - "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), |
10 |
| - "length": ("INT", {"default": 25, "min": 7, "max": nodes.MAX_RESOLUTION, "step": 6}), |
11 |
| - "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096})}} |
12 |
| - RETURN_TYPES = ("LATENT",) |
13 |
| - FUNCTION = "generate" |
14 | 7 |
|
15 |
| - CATEGORY = "latent/video" |
| 8 | +class EmptyMochiLatentVideo(io.ComfyNode): |
| 9 | + @classmethod |
| 10 | + def define_schema(cls): |
| 11 | + return io.Schema( |
| 12 | + node_id="EmptyMochiLatentVideo", |
| 13 | + category="latent/video", |
| 14 | + inputs=[ |
| 15 | + io.Int.Input("width", default=848, min=16, max=nodes.MAX_RESOLUTION, step=16), |
| 16 | + io.Int.Input("height", default=480, min=16, max=nodes.MAX_RESOLUTION, step=16), |
| 17 | + io.Int.Input("length", default=25, min=7, max=nodes.MAX_RESOLUTION, step=6), |
| 18 | + io.Int.Input("batch_size", default=1, min=1, max=4096), |
| 19 | + ], |
| 20 | + outputs=[ |
| 21 | + io.Latent.Output(), |
| 22 | + ], |
| 23 | + ) |
16 | 24 |
|
17 |
| - def generate(self, width, height, length, batch_size=1): |
| 25 | + @classmethod |
| 26 | + def execute(cls, width, height, length, batch_size=1) -> io.NodeOutput: |
18 | 27 | latent = torch.zeros([batch_size, 12, ((length - 1) // 6) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())
|
19 |
| - return ({"samples":latent}, ) |
| 28 | + return io.NodeOutput({"samples": latent}) |
| 29 | + |
| 30 | + |
| 31 | +class MochiExtension(ComfyExtension): |
| 32 | + @override |
| 33 | + async def get_node_list(self) -> list[type[io.ComfyNode]]: |
| 34 | + return [ |
| 35 | + EmptyMochiLatentVideo, |
| 36 | + ] |
| 37 | + |
20 | 38 |
|
21 |
| -NODE_CLASS_MAPPINGS = { |
22 |
| - "EmptyMochiLatentVideo": EmptyMochiLatentVideo, |
23 |
| -} |
| 39 | +async def comfy_entrypoint() -> MochiExtension: |
| 40 | + return MochiExtension() |
0 commit comments