Two-stage distilled inference pipeline that animates a character from a driving
video, wiring the Phase 1-3 SCAIL-2 conditioning into a runnable CLI.
- scail_animation.py: ScailAnimationPipeline (mirrors distilled.py) plus a pure,
testable build_scail_conditionings that assembles VideoConditionByDrivingLatent
+ VideoConditionByMaskChannels (driving appended, mask on the trailing driving
tokens), and a load_masks helper. main() + scail_animation_arg_parser add
--driving-video / --mask-path / --mode / --driving-strength on top of the
standard two-stage distilled parser.
- LTXModelConfigurator now reads config `mask_conditioning_channels`, so a
SCAIL-trained checkpoint whose config declares it builds the widened
patchify_proj automatically — no runtime widening wrapper needed at inference.
- CLAUDE.md pipeline table row.
Verified on CPU (verify_phase4_pipeline.py): the module imports, the CLI parses
the SCAIL flags, build_scail_conditionings grows the sequence and places the mask
channels on the driving tokens (target stays zero), driving-only leaves
cond_channels None, and the configurator honors mask_conditioning_channels
(patchify_proj widened from config). End-to-end runs still need a GPU and a
SCAIL-trained checkpoint.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Port mechanism 2 of SCAIL-2 (arXiv:2606.10804) to LTX-2: extra per-token
in-context conditioning channels (1 environment switch + K=6 character binding
slots) concatenated onto the latent before the first projection.
Faithful temporal encoding for LTX's VAE (temporal factor 8): each latent frame
stacks its 8 pixel sub-frames along the channel dim, giving 8*(K+1)=56 channels
(vs the paper's 4*(K+1)=28 on Wan 2.1).
Plumbing (backward compatible; cond_channels=None leaves every existing pipeline
unchanged):
- LatentState/Modality gain an optional cond_channels field (patchified [B,T,C]).
- LTXModel(mask_conditioning_channels=0) config-gates a widened patchify_proj;
TransformerArgsPreprocessor concatenates cond_channels (or zero-pads) before it.
- tools.clear_conditioning trims it; token-appending conditioning items
(reference video/audio, driving, keyframe) extend it via extend_cond_channels.
New:
- VideoConditionByMaskChannels: encodes (K+1) pixel masks -> 56 channels, written
onto the trailing driving tokens (noisy target stays all-zero, per the paper).
- widen_patchify_proj_for_mask_channels: zero-init checkpoint surgery so a
converted model reproduces the base output exactly until finetuned.
Verified (CPU, random weights): backward compat, zero-init widened forward is
bit-identical to baseline for any cond_channels, and the driving+mask pipeline
forwards without crashing with correct placement/clipping. Visual quality
requires Phase 3 finetuning; Replacement-mode z_ref height shift still deferred.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>