[modular] LTX-2.5: two-stage generation as one pipeline - #14612
Open
yiyixuxu wants to merge 1 commit into
Open
Conversation
Add `LTX25TwoStageBlocks` / `LTX25TwoStageModularPipeline`: the distilled two-stage recipe (first pass, 2x latent upsample, second pass, diffusion decode) as a single modular pipeline for every workflow `LTX25AutoBlocks` supports. The stages are ordinary blocks that can be popped and run on their own. - split the shared LTX-2 leaves into first-pass / second-pass blocks (`LTX2Stage2PrepareLatentsStep`, `LTX2Stage2PrepareAudioLatentsStep`, `LTX2ConditionStage2PrepareLatentsStep`) with `sigmas_name` / `sigmas_default` init arguments instead of branching on `latents` inside one block - every core-denoise group takes and leaves latents in the VAE form: `LTX2UnpackLatentsStep` closes each group, encoders normalize and decoders denormalize, `LTX2LatentUpsampleStep` bridges the passes - `modular_blocks_ltx25.py` is self-contained (no imports from the LTX-2 preset), with the distilled schedules as defaults and no `num_inference_steps`; `LTX25ModularPipeline` carries the LTX-2.5 latent statistics as the fallback for stages run without an autoencoder - geometry and statistics come from pipeline properties instead of declaring `vae` / `audio_vae` in denoise-side blocks; `use_cross_timestep` is a pipeline property; `batch_size` / `dtype` come from the text input step; the in-context attention mask is built inside the prepare-latents block - agent guide: gotcha on latent form across block boundaries Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
LTX25TwoStageBlocksthe distilled two-stage recipe as a single modular pipeline:for every workflow
LTX25AutoBlockssupports (t2v / i2v / condition / in-context). It is assembled from the same leaf blocks asLTX25AutoBlocks, and the stages are ordinary blocks, so you can pop them and run a pass on its own.setup
example usage1: Single stage, everything at its default
pipe.blocks.get_workflow("text2video").inputs— the distilled schedule is the default,num_framesis predicted by the duration head when omitted, and there is nonum_inference_steps: the checkpoint runs a fixed sigma schedule, so there is no step count to choose.promptnegative_prompt,max_sequence_lengthNone,1024num_frames,min_seconds,max_seconds,frame_rateNone(auto),1.0,20.0,24.0sigmas,timestepsDISTILLED_SIGMA_VALUES,Noneheight,width512,704num_videos_per_prompt,generator,attention_kwargs,output_type1,None,None,"pil"example usage 2: Two stages as one call
pipe.blocks.get_workflow("text2video").inputs— everything at its default again. The second pass reads its schedule under its own names (stage_2_*) so both passes can sit in one pipeline, and takes itsheight/width/num_framesfrom the upsampled latents rather than as inputs:promptnegative_prompt,max_sequence_lengthNone,1024num_frames,min_seconds,max_seconds,frame_rateNone(auto),1.0,20.0,24.0sigmas,timestepsDISTILLED_SIGMA_VALUES,Noneheight,width512,704(the first pass; the output is 2x)stage_2_sigmas,stage_2_timestepsSTAGE_2_DISTILLED_SIGMA_VALUES,Nonenoise_scaleNone→stage_2_sigmas[0], the level the upsampled latents are re-noised tonum_videos_per_prompt,generator,attention_kwargs,output_type1,None,None,"pil"example usage3: Two stages separately
you can pop each stage into their own pipelines and hand the state along. For instance, preview the first pass (and re-run it as many times as you like) before spending the second pass on it:
stage_2.inputs— what the popped second pass takes on its own (this isLTX25AutoStage2CoreDenoiseStep, so the inputs are the union of its t2v / i2v / condition branches). Everything comes from the first pass's state; its own settings are at their defaults:latents,audio_latentsstage_1(latentsthroughupsample)connector_prompt_embeds,connector_audio_prompt_embeds,connector_attention_masktext_encoder+inputnegative_connector_*(3)Nonebatch_size,dtypeinputstage_2_sigmas,stage_2_timestepsSTAGE_2_DISTILLED_SIGMA_VALUES,Nonenoise_scaleNone→stage_2_sigmas[0]frame_rate,num_videos_per_prompt,generator,attention_kwargs24.0,1,None,Noneimage_latents/condition_latents,condition_strengths,condition_indices,condition_pixel_framesstage_2_*encodersNoneNo
height/width/num_frames: the second pass reads them off the latents. (upsamplealone takes justlatents;decodetakeslatents,audio_latents,generator,output_type.)