From 7126ecffde66036070c6feef5e4c92d1ec2de025 Mon Sep 17 00:00:00 2001 From: spacepxl <143970342+spacepxl@users.noreply.github.com> Date: Sat, 23 Nov 2024 21:33:08 -0500 Subject: [PATCH 1/3] set LTX min length to 1 for t2i (#5750) At length=1, the LTX model can do txt2img and img2img with no other changes required. --- comfy_extras/nodes_lt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 9d0639378..e6a48fc4c 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -10,7 +10,7 @@ class EmptyLTXVLatentVideo: def INPUT_TYPES(s): return {"required": { "width": ("INT", {"default": 768, "min": 64, "max": nodes.MAX_RESOLUTION, "step": 32}), "height": ("INT", {"default": 512, "min": 64, "max": nodes.MAX_RESOLUTION, "step": 32}), - "length": ("INT", {"default": 97, "min": 9, "max": nodes.MAX_RESOLUTION, "step": 8}), + "length": ("INT", {"default": 97, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 8}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096})}} RETURN_TYPES = ("LATENT",) FUNCTION = "generate" From 3d802710e7b3b86221eec5d4a0aababdd9b81ba1 Mon Sep 17 00:00:00 2001 From: 40476 <63472353+40476@users.noreply.github.com> Date: Sun, 24 Nov 2024 04:12:07 -0500 Subject: [PATCH 2/3] Update README.md (#5707) --- README.md | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 2e1cbb72b..d26f0fe9d 100644 --- a/README.md +++ b/README.md @@ -75,37 +75,37 @@ Workflow examples can be found on the [Examples page](https://comfyanonymous.git | Keybind | Explanation | |------------------------------------|--------------------------------------------------------------------------------------------------------------------| -| Ctrl + Enter | Queue up current graph for generation | -| Ctrl + Shift + Enter | Queue up current graph as first for generation | -| Ctrl + Alt + Enter | Cancel current generation | -| Ctrl + Z/Ctrl + Y | Undo/Redo | -| Ctrl + S | Save workflow | -| Ctrl + O | Load workflow | -| Ctrl + A | Select all nodes | -| Alt + C | Collapse/uncollapse selected nodes | -| Ctrl + M | Mute/unmute selected nodes | -| Ctrl + B | Bypass selected nodes (acts like the node was removed from the graph and the wires reconnected through) | -| Delete/Backspace | Delete selected nodes | -| Ctrl + Backspace | Delete the current graph | -| Space | Move the canvas around when held and moving the cursor | -| Ctrl/Shift + Click | Add clicked node to selection | -| Ctrl + C/Ctrl + V | Copy and paste selected nodes (without maintaining connections to outputs of unselected nodes) | -| Ctrl + C/Ctrl + Shift + V | Copy and paste selected nodes (maintaining connections from outputs of unselected nodes to inputs of pasted nodes) | -| Shift + Drag | Move multiple selected nodes at the same time | -| Ctrl + D | Load default graph | -| Alt + `+` | Canvas Zoom in | -| Alt + `-` | Canvas Zoom out | -| Ctrl + Shift + LMB + Vertical drag | Canvas Zoom in/out | -| P | Pin/Unpin selected nodes | -| Ctrl + G | Group selected nodes | -| Q | Toggle visibility of the queue | -| H | Toggle visibility of history | -| R | Refresh graph | +| `Ctrl` + `Enter` | Queue up current graph for generation | +| `Ctrl` + `Shift` + `Enter` | Queue up current graph as first for generation | +| `Ctrl` + `Alt` + `Enter` | Cancel current generation | +| `Ctrl` + `Z`/`Ctrl` + `Y` | Undo/Redo | +| `Ctrl` + `S` | Save workflow | +| `Ctrl` + `O` | Load workflow | +| `Ctrl` + `A` | Select all nodes | +| `Alt `+ `C` | Collapse/uncollapse selected nodes | +| `Ctrl` + `M` | Mute/unmute selected nodes | +| `Ctrl` + `B` | Bypass selected nodes (acts like the node was removed from the graph and the wires reconnected through) | +| `Delete`/`Backspace` | Delete selected nodes | +| `Ctrl` + `Backspace` | Delete the current graph | +| `Space` | Move the canvas around when held and moving the cursor | +| `Ctrl`/`Shift` + `Click` | Add clicked node to selection | +| `Ctrl` + `C`/`Ctrl` + `V` | Copy and paste selected nodes (without maintaining connections to outputs of unselected nodes) | +| `Ctrl` + `C`/`Ctrl` + `Shift` + `V` | Copy and paste selected nodes (maintaining connections from outputs of unselected nodes to inputs of pasted nodes) | +| `Shift` + `Drag` | Move multiple selected nodes at the same time | +| `Ctrl` + `D` | Load default graph | +| `Alt` + `+` | Canvas Zoom in | +| `Alt` + `-` | Canvas Zoom out | +| `Ctrl` + `Shift` + LMB + Vertical drag | Canvas Zoom in/out | +| `P` | Pin/Unpin selected nodes | +| `Ctrl` + `G` | Group selected nodes | +| `Q` | Toggle visibility of the queue | +| `H` | Toggle visibility of history | +| `R` | Refresh graph | | Double-Click LMB | Open node quick search palette | -| Shift + Drag | Move multiple wires at once | -| Ctrl + Alt + LMB | Disconnect all wires from clicked slot | +| `Shift` + Drag | Move multiple wires at once | +| `Ctrl` + `Alt` + LMB | Disconnect all wires from clicked slot | -Ctrl can also be replaced with Cmd instead for macOS users +`Ctrl` can also be replaced with `Cmd` instead for macOS users # Installing From b4526d3fc3c4b6d42ea27d16e38cfecb6c54ef7e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 24 Nov 2024 05:54:30 -0500 Subject: [PATCH 3/3] Skip layer guidance now works on hydit model. --- comfy/ldm/hydit/models.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/hydit/models.py b/comfy/ldm/hydit/models.py index 44e806cba..88459457d 100644 --- a/comfy/ldm/hydit/models.py +++ b/comfy/ldm/hydit/models.py @@ -287,7 +287,7 @@ class HunYuanDiT(nn.Module): style=None, return_dict=False, control=None, - transformer_options=None, + transformer_options={}, ): """ Forward pass of the encoder. @@ -315,8 +315,7 @@ class HunYuanDiT(nn.Module): return_dict: bool Whether to return a dictionary. """ - #import pdb - #pdb.set_trace() + patches_replace = transformer_options.get("patches_replace", {}) encoder_hidden_states = context text_states = encoder_hidden_states # 2,77,1024 text_states_t5 = encoder_hidden_states_t5 # 2,256,2048 @@ -364,6 +363,8 @@ class HunYuanDiT(nn.Module): # Concatenate all extra vectors c = t + self.extra_embedder(extra_vec) # [B, D] + blocks_replace = patches_replace.get("dit", {}) + controls = None if control: controls = control.get("output", None) @@ -375,9 +376,20 @@ class HunYuanDiT(nn.Module): skip = skips.pop() + controls.pop().to(dtype=x.dtype) else: skip = skips.pop() - x = block(x, c, text_states, freqs_cis_img, skip) # (N, L, D) else: - x = block(x, c, text_states, freqs_cis_img) # (N, L, D) + skip = None + + if ("double_block", layer) in blocks_replace: + def block_wrap(args): + out = {} + out["img"] = block(args["img"], args["vec"], args["txt"], args["pe"], args["skip"]) + return out + + out = blocks_replace[("double_block", layer)]({"img": x, "txt": text_states, "vec": c, "pe": freqs_cis_img, "skip": skip}, {"original_block": block_wrap}) + x = out["img"] + else: + x = block(x, c, text_states, freqs_cis_img, skip) # (N, L, D) + if layer < (self.depth // 2 - 1): skips.append(x)