From 0d9b685c2ffbdced32ebd6edf5b41c43a3e80904 Mon Sep 17 00:00:00 2001 From: facok <128763816+facok@users.noreply.github.com> Date: Sat, 21 Mar 2026 22:17:42 +0800 Subject: [PATCH] Clean up: remove unused pack_info fields and legacy constants --- core/sampling.py | 13 +++---------- nodes/intervene.py | 4 ++-- nodes/sharpen.py | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/core/sampling.py b/core/sampling.py index 52e1e47..7b07fa9 100644 --- a/core/sampling.py +++ b/core/sampling.py @@ -1,11 +1,8 @@ """Shared sampling utilities for LCS intervention hooks.""" +import comfy.utils import torch -# Legacy FLUX constants — kept for backward compatibility with observe.py preview -SCALE_FACTOR = 0.3611 -SHIFT_FACTOR = 0.1159 - def find_step_index(sigma, sigmas): """Find the step index for a given sigma value in the sigma schedule. @@ -51,24 +48,20 @@ def unpack_video_if_needed(denoised, args): cond = args.get("cond") latent_shapes = _extract_latent_shapes(cond) if latent_shapes is not None and len(latent_shapes) > 1: - import comfy.utils tensors = comfy.utils.unpack_latents(denoised, latent_shapes) # tensors[0] = video [B, 128, F, H, W], tensors[1] = audio [B, ch, T, freq] - return tensors[0], {"packed": True, "latent_shapes": latent_shapes, - "other_tensors": tensors[1:], "original": denoised} + return tensors[0], {"other_tensors": tensors[1:]} return denoised, None -def repack_video_if_needed(modified, original_denoised, pack_info): +def repack_video_if_needed(modified, pack_info): """Repack video tensor back into LTXAV packed format if it was unpacked. modified: the video tensor after intervention [B, 128, F, H, W] - original_denoised: the original packed tensor (for audio portion) pack_info: from unpack_video_if_needed """ if pack_info is None: return modified - import comfy.utils all_tensors = [modified] + pack_info["other_tensors"] packed, _ = comfy.utils.pack_latents(all_tensors) return packed diff --git a/nodes/intervene.py b/nodes/intervene.py index dcd5561..ad0fd60 100644 --- a/nodes/intervene.py +++ b/nodes/intervene.py @@ -167,7 +167,7 @@ def _build_post_cfg_fn(lcs_data, target_colors_hsl, strength, mode, start_step, modified = raw_to_denoised(raw_new, model).to(dtype) # Repack if LTXAV - return repack_video_if_needed(modified, denoised, pack_info) + return repack_video_if_needed(modified, pack_info) return post_cfg_fn @@ -424,7 +424,7 @@ def _build_tone_fn(lcs_data, contrast, brightness, saturation, color_temperature modified = raw_to_denoised(raw_new, model).to(dtype) # Repack if LTXAV - return repack_video_if_needed(modified, denoised, pack_info) + return repack_video_if_needed(modified, pack_info) return post_cfg_fn diff --git a/nodes/sharpen.py b/nodes/sharpen.py index d9aaeae..82c0723 100644 --- a/nodes/sharpen.py +++ b/nodes/sharpen.py @@ -159,7 +159,7 @@ def _build_sharpness_fn(sharpness_data, strength, start_step, end_step, mask): modified = raw_to_denoised(raw_new, model).to(dtype) # Repack if LTXAV - return repack_video_if_needed(modified, denoised, pack_info) + return repack_video_if_needed(modified, pack_info) return post_cfg_fn