The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Add node to create empty latents for qwen image layered model. (#11460)
comfyanonymous91bf6b6aa3d5
diff --git a/comfy_extras/nodes_qwen.py b/comfy_extras/nodes_qwen.pyindex 525239ae5..fde8fac9a 100644--- a/comfy_extras/nodes_qwen.py+++ b/comfy_extras/nodes_qwen.py@@ -3,7 +3,9 @@ import comfy.utilsimport mathfrom typing_extensions import overridefrom comfy_api.latest import ComfyExtension, io-+import comfy.model_management+import torch+import nodesclass TextEncodeQwenImageEdit(io.ComfyNode):@classmethod@@ -104,12 +106,37 @@ class TextEncodeQwenImageEditPlus(io.ComfyNode):return io.NodeOutput(conditioning)+class EmptyQwenImageLayeredLatentImage(io.ComfyNode):+ @classmethod+ def define_schema(cls):+ return io.Schema(+ node_id="EmptyQwenImageLayeredLatentImage",+ display_name="Empty Qwen Image Layered Latent",+ category="latent/qwen",+ inputs=[+ io.Int.Input("width", default=640, min=16, max=nodes.MAX_RESOLUTION, step=16),+ io.Int.Input("height", default=640, min=16, max=nodes.MAX_RESOLUTION, step=16),+ io.Int.Input("layers", default=3, min=0, max=nodes.MAX_RESOLUTION, step=1),+ io.Int.Input("batch_size", default=1, min=1, max=4096),+ ],+ outputs=[+ io.Latent.Output(),+ ],+ )++ @classmethod+ def execute(cls, width, height, layers, batch_size=1) -> io.NodeOutput:+ latent = torch.zeros([batch_size, 16, layers + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device())+ return io.NodeOutput({"samples": latent})++class QwenExtension(ComfyExtension):@overrideasync def get_node_list(self) -> list[type[io.ComfyNode]]:return [TextEncodeQwenImageEdit,TextEncodeQwenImageEditPlus,+ EmptyQwenImageLayeredLatentImage,]