From 9c9a7f012a5396a55d9d23dadcf87bcf3713b605 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 05:16:05 -0500 Subject: [PATCH 01/10] Adjust ltxv memory factor. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 26340900b..7e37a17b1 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -762,7 +762,7 @@ class LTXV(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.LTXV - memory_usage_factor = 2.7 + memory_usage_factor = 5.5 # TODO: img2vid is about 2x vs txt2vid supported_inference_dtypes = [torch.bfloat16, torch.float32] From 369b079ff62d1677d61904bcc133aa88c43154b0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 05:26:08 -0500 Subject: [PATCH 02/10] Fix lowvram issue with ltxv vae. --- comfy/ldm/lightricks/vae/causal_video_autoencoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py index 043ca0496..f91870d71 100644 --- a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py +++ b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py @@ -695,7 +695,7 @@ class DepthToSpaceUpsample(nn.Module): class LayerNorm(nn.Module): def __init__(self, dim, eps, elementwise_affine=True) -> None: super().__init__() - self.norm = nn.LayerNorm(dim, eps=eps, elementwise_affine=elementwise_affine) + self.norm = ops.LayerNorm(dim, eps=eps, elementwise_affine=elementwise_affine) def forward(self, x): x = rearrange(x, "b c d h w -> b d h w c") From dc134b2fdbbd9fc40d04b760d24551b291f06776 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 06:28:14 -0500 Subject: [PATCH 03/10] Bump ComfyUI version to v0.3.20 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 5ded466ad..488c134bf 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.19" +__version__ = "0.3.20" diff --git a/pyproject.toml b/pyproject.toml index 444a1efc1..171de091c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.19" +version = "0.3.20" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 30e6cfb1a0eaa9651ca9bcb403d7b98c0f313bf5 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 07:18:13 -0500 Subject: [PATCH 04/10] Fix LTXVPreprocess on resolutions that are not multiples of 2. --- comfy_extras/nodes_lt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 8bd548bcd..d3f3ac3a1 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -413,7 +413,7 @@ def preprocess(image: torch.Tensor, crf=29): if crf == 0: return image - image_array = (image * 255.0).byte().cpu().numpy() + image_array = (image[:(image.shape[0] // 2) * 2, :(image.shape[1] // 2) * 2] * 255.0).byte().cpu().numpy() with io.BytesIO() as output_file: encode_single_frame(output_file, image_array, crf) video_bytes = output_file.getvalue() @@ -449,10 +449,10 @@ class LTXVPreprocess: def preprocess(self, image, img_compression): output_image = image if img_compression > 0: - output_image = torch.zeros_like(image) + output_images = [] for i in range(image.shape[0]): - output_image[i] = preprocess(image[i], img_compression) - return (output_image,) + output_images.append(preprocess(image[i], img_compression)) + return (torch.stack(output_images),) NODE_CLASS_MAPPINGS = { From 77633ba77d11b95b43cb1696210809477d939469 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 07:31:47 -0500 Subject: [PATCH 05/10] Remove unused variable. --- comfy_extras/nodes_lt.py | 1 - 1 file changed, 1 deletion(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index d3f3ac3a1..f43cb54a2 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -447,7 +447,6 @@ class LTXVPreprocess: CATEGORY = "image" def preprocess(self, image, img_compression): - output_image = image if img_compression > 0: output_images = [] for i in range(image.shape[0]): From 6d45ffbe231040fc0d5b98e9a08986f604552161 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 08:05:22 -0500 Subject: [PATCH 06/10] Bump ComfyUI version to v0.3.21 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 488c134bf..c0be6ed55 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.20" +__version__ = "0.3.21" diff --git a/pyproject.toml b/pyproject.toml index 171de091c..396f20c61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.20" +version = "0.3.21" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 872780d236ca5485f9f1393fbd2ae459d6055a84 Mon Sep 17 00:00:00 2001 From: Andrew Kvochko Date: Wed, 5 Mar 2025 15:47:32 +0200 Subject: [PATCH 07/10] fix: ltxv crop guides works with 0 keyframes (#7085) This patch fixes a bug in LTXVCropGuides when the latent has no keyframes. Additionally, the first frame is always added as a keyframe. Co-authored-by: Andrew Kvochko --- comfy_extras/nodes_lt.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index f43cb54a2..b608b9407 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -194,11 +194,6 @@ class LTXVAddGuide: frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." - if frame_idx == 0: - latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) - return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) - - num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) positive, negative, latent_image, noise_mask = self.append_keyframe( @@ -252,6 +247,8 @@ class LTXVCropGuides: noise_mask = get_noise_mask(latent) _, num_keyframes = get_keyframe_idxs(positive) + if num_keyframes == 0: + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) latent_image = latent_image[:, :, :-num_keyframes] noise_mask = noise_mask[:, :, :-num_keyframes] From a80bc822a206e5d728e735f647c4c25b6c035b2d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 08:58:44 -0500 Subject: [PATCH 08/10] Partially revert last commit. --- comfy_extras/nodes_lt.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index b608b9407..4550b246a 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -194,6 +194,11 @@ class LTXVAddGuide: frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." + if frame_idx == 0: + latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) + + num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) positive, negative, latent_image, noise_mask = self.append_keyframe( From 76739c23c3c7e3617fb76bb25f7efc1ebba949de Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 09:57:40 -0500 Subject: [PATCH 09/10] Revert "Partially revert last commit." This reverts commit a80bc822a206e5d728e735f647c4c25b6c035b2d. --- comfy_extras/nodes_lt.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 4550b246a..b608b9407 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -194,11 +194,6 @@ class LTXVAddGuide: frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." - if frame_idx == 0: - latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) - return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) - - num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) positive, negative, latent_image, noise_mask = self.append_keyframe( From 889519971fe530abbdc689af20aa439c5e99875f Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 10:06:37 -0500 Subject: [PATCH 10/10] Bump ComfyUI version to v0.3.22 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index c0be6ed55..0e50db99b 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.21" +__version__ = "0.3.22" diff --git a/pyproject.toml b/pyproject.toml index 396f20c61..9dbbe7cc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.21" +version = "0.3.22" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9"