From 94d1df4b830562fc81b5a72237d4133dad949098 Mon Sep 17 00:00:00 2001 From: Mihail Karaev Date: Mon, 2 Feb 2026 09:26:09 +0000 Subject: [PATCH] Small fixes Kandinsky5 --- comfy/model_base.py | 12 ++---------- comfy_extras/nodes_kandinsky5.py | 12 ++++++------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index a78a7bbcc..4539f6495 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1791,17 +1791,9 @@ class Kandinsky5Image(Kandinsky5): def concat_cond(self, **kwargs): return None -class Kandinsky5ImageToImage(BaseModel): +class Kandinsky5ImageToImage(Kandinsky5): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): - super().__init__( - model_config, - model_type, - device=device, - unet_model=comfy.ldm.kandinsky5.model.Kandinsky5 - ) - - def encode_adm(self, **kwargs): - return kwargs["pooled_output"] + super().__init__(model_config, model_type, device=device) def concat_cond(self, **kwargs): noise = kwargs["noise"] diff --git a/comfy_extras/nodes_kandinsky5.py b/comfy_extras/nodes_kandinsky5.py index e3bfd8d99..111cfbb61 100644 --- a/comfy_extras/nodes_kandinsky5.py +++ b/comfy_extras/nodes_kandinsky5.py @@ -62,15 +62,15 @@ class Kandinsky5ImageToImage(io.ComfyNode): def define_schema(cls): return io.Schema( node_id="Kandinsky5ImageToImage", - category="image", + category="advanced/conditioning/kandinsky5", inputs=[ io.Vae.Input("vae"), io.Int.Input("batch_size", default=1, min=1, max=4096), io.Image.Input("start_image"), ], outputs=[ - io.Latent.Output(display_name="latent", tooltip="Empty video latent"), - io.Image.Output("resized_image"), + io.Latent.Output(display_name="latent", tooltip="Latent of resized source image"), + io.Image.Output("resized_image", tooltip="Resized source image"), ], ) @@ -78,8 +78,8 @@ class Kandinsky5ImageToImage(io.ComfyNode): def execute(cls, vae, batch_size, start_image) -> io.NodeOutput: height, width = start_image.shape[1:-1] available_res = [(1024, 1024), (640, 1408), (1408, 640), (768, 1280), (1280, 768), (896, 1152), (1152, 896)] - nearest_index = torch.argmin(torch.Tensor([abs((w / h) - (width / height))for (w, h) in available_res])) - nw, nh = available_res[nearest_index] + nearest_index = torch.argmin(torch.Tensor([abs((h / w) - (height / width))for (h, w) in available_res])) + nh, nw = available_res[nearest_index] scale_factor = min(height / nh, width / nw) start_image = start_image.permute(0,3,1,2) start_image = F.resize(start_image, (int(height / scale_factor), int(width / scale_factor))) @@ -150,7 +150,7 @@ class CLIPTextEncodeKandinsky5(io.ComfyNode): return io.Schema( node_id="CLIPTextEncodeKandinsky5", search_aliases=["kandinsky prompt"], - category="advanced/conditioning", + category="advanced/conditioning/kandinsky5", inputs=[ io.Clip.Input("clip"), io.String.Input("prompt", multiline=True, dynamic_prompts=True),