Fix guide keyframe misalignment when causal_window_fix is on with full guides

This commit is contained in:
ozbayb 2026-04-26 19:38:51 -06:00
parent e0ea2e41c8
commit cbe2a1ba42
2 changed files with 8 additions and 0 deletions

View File

@ -280,6 +280,10 @@ class WindowingState:
guide_entries = self.guide_entries[modality_idx] guide_entries = self.guide_entries[modality_idx]
guide_frames = self.guide_latents[modality_idx] guide_frames = self.guide_latents[modality_idx]
suffix_idx, overlap_info, kf_local_pos, guide_frame_count = compute_guide_overlap(guide_entries, window.index_list) suffix_idx, overlap_info, kf_local_pos, guide_frame_count = compute_guide_overlap(guide_entries, window.index_list)
# Shift keyframe positions to account for causal_window_fix anchor occupying sub-pos 0.
anchor_idx = getattr(window, 'causal_anchor_index', None)
if anchor_idx is not None and anchor_idx >= 0:
kf_local_pos = [p + 1 for p in kf_local_pos]
window.guide_frames_indices = suffix_idx window.guide_frames_indices = suffix_idx
window.guide_overlap_info = overlap_info window.guide_overlap_info = overlap_info
window.guide_kf_local_positions = kf_local_pos window.guide_kf_local_positions = kf_local_pos

View File

@ -1166,6 +1166,10 @@ class LTXAV(BaseModel):
return cond_value._copy_with(cond_value.cond[:, :, :0, :]) # empty return cond_value._copy_with(cond_value.cond[:, :, :0, :]) # empty
H, W = x_in.shape[3], x_in.shape[4] H, W = x_in.shape[3], x_in.shape[4]
window_len = len(window.index_list) window_len = len(window.index_list)
# account for causal_window_fix anchor in coord space size
anchor_idx = getattr(window, 'causal_anchor_index', None)
if anchor_idx is not None and anchor_idx >= 0:
window_len += 1
patchifier = self.diffusion_model.patchifier patchifier = self.diffusion_model.patchifier
latent_coords = patchifier.get_latent_coords(window_len, H, W, 1, cond_value.cond.device) latent_coords = patchifier.get_latent_coords(window_len, H, W, 1, cond_value.cond.device)
scale_factors = self.diffusion_model.vae_scale_factors scale_factors = self.diffusion_model.vae_scale_factors