This commit is contained in:
Will Lin
2026-02-06 15:41:09 -08:00
parent 6566a05dac
commit 3bd2a885e4
2 changed files with 20 additions and 16 deletions
@@ -34,12 +34,12 @@ def main() -> None:
generator.generate_video(
prompt=PROMPT,
output_path=OUTPUT_PATH,
height=1024,
width=1792,
height=960,
width=1664,
num_frames=81,
fps=24,
seed=10,
# Distilled schedule in LTX-2 uses 8 steps; setting this keeps parity.
# DistilledPipeline uses the 8-step distilled schedule without CFG.
num_inference_steps=8,
guidance_scale=1.0,
save_video=True,
+17 -13
View File
@@ -115,20 +115,22 @@ class LTX2UpsampleStage(PipelineStage):
raise ValueError(
"Latents must be available before LTX-2 upsample stage.")
# Ensure upsampler matches latent dtype/device to avoid conv mismatch.
latents = batch.latents
orig_dtype = latents.dtype
orig_device = latents.device
if isinstance(self.upsampler, torch.nn.Module):
target_dtype = batch.latents.dtype
target_device = batch.latents.device
first_param = next(self.upsampler.parameters(), None)
if first_param is not None and (first_param.dtype != target_dtype
or first_param.device
!= target_device):
self.upsampler.to(device=target_device, dtype=target_dtype)
logger.info(
"[LTX2] Cast upsampler to %s on %s to match latents.",
target_dtype,
target_device,
)
if first_param is not None:
if first_param.device != orig_device:
latents = latents.to(device=first_param.device)
if first_param.dtype != latents.dtype:
latents = latents.to(dtype=first_param.dtype)
if latents.dtype != orig_dtype or latents.device != orig_device:
logger.info(
"[LTX2] Cast latents to %s on %s for upsampler.",
latents.dtype,
latents.device,
)
target_height = batch.extra.get("ltx2_refine_target_height")
target_width = batch.extra.get("ltx2_refine_target_width")
@@ -141,7 +143,9 @@ class LTX2UpsampleStage(PipelineStage):
"LTX-2 VAE encoder is required for latent upsampling.")
upsampler_module = getattr(self.upsampler, "model", self.upsampler)
latents = upsample_video(batch.latents, video_encoder, upsampler_module)
latents = upsample_video(latents, video_encoder, upsampler_module)
if latents.dtype != orig_dtype or latents.device != orig_device:
latents = latents.to(device=orig_device, dtype=orig_dtype)
sigma0 = float(self.sigmas[0]) if self.sigmas else 1.0
if self.add_noise: