SCAIL-2 character animation port (Phases 1-4) #1
Reference in New Issue
Block a user
Delete Branch "scail2-driving-cond-phase1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Port the SCAIL-2 (arXiv:2606.10804) end-to-end character-animation method to LTX-2. SCAIL-2 was built on Wan 2.1, so this is a cross-architecture port. All four phases are implemented and pass CPU-level plumbing/integration verification; real training and end-to-end inference still need a GPU + a SCAIL-trained checkpoint.
Phases
Phase 1 — Driving-latent concatenation + mode-specific RoPE (
baa6646)VideoConditionByDrivingLatent+DrivingModein ltx-core: concatenate the driving latent into the DiT token sequence with a RoPE width offset (ΔW), time-aligned to the target, with wrap/shape guards. No weight changes.Phase 2 — In-context mask channels + zero-init checkpoint surgery (
110adc7)cond_channelsonLatentState/Modality, concatenated onto the latent before a config-gated widenedpatchify_proj.VideoConditionByMaskChannels: (K+1) semantic masks →8*(K+1)=56channels (faithful LTX temporal-factor-8 stacking) written onto the driving tokens; target stays zero.widen_patchify_proj_for_mask_channelszero-init surgery — a converted checkpoint reproduces the base output exactly until finetuned.Phase 3 — Training integration (
e03cc62)DrivingConditionConfig+MaskChannelsConditionConfigin the trainer'sFlexibleStrategy;load_transformer(mask_conditioning_channels=)widens at load; LoRA mode additionally unfreezespatchify_proj(the new columns can't be reached by LoRA).configs/scail_animation_lora.yaml+ docs.Phase 4 — Inference pipeline + CLI (
06c0870)ScailAnimationPipeline+build_scail_conditionings+scail_animation_arg_parser.LTXModelConfiguratorreadsmask_conditioning_channels, so a SCAIL-trained checkpoint is self-describing (auto-widens on load — no runtime wrapper).Fix — ltx-trainer ruff config (
a598f89)[tool.ruff] target-versionwas accidentally the package version"1.1.7", which made ruff skip the whole package. Set topy310; fixed the hidden too-many-branches finding it then surfaced.Verification
Each phase has a CPU verification (no GPU/checkpoint): sequence growth, ΔW non-overlap, attention/denoise masks, zero-init equivalence (bit-identical output), training
prepare_training_inputs+ loss step, CLI round-trip, and self-describing config.ruff checkpasses across the changed packages.Not included (data/GPU work)
Dataset preprocessing (driving latents + semantic masks, needs a segmentation model), validation-runner wiring, real training/inference on GPU, and the Replacement-mode
z_refheight shift (needs a separate reference token group).🤖 Generated with Claude Code
scripts/process_char_masks.py turns per-sample character label-map videos/images (integer pixel labels: 0 = environment, 1..K = characters -> binding slots) into the pixel-space semantic-mask tensors the SCAIL training/inference path consumes: {"mask": [K+1, F_pix, H_pix, W_pix]} (ch0 = environment switch, ch1..K = slots). - Aligns to the target video's latent grid read from the saved latent metadata (F_pix=(F-1)*8+1, H*32, W*32), so char_masks/ lines up file-for-file with latents/ / driving_latents/ for PrecomputedDataset. - Nearest-neighbour resize so integer labels are never blended; labels > K are dropped with a warning; ch0 filled uniformly with --environment-switch. - Reuses process_videos.py helpers (naming, atomic save, VAE factors) and matches its typer CLI conventions. Verified on CPU: a synthetic 2-character label map (plus an out-of-range id) produces mask (7,17,128,128) with ch0 uniform, slots placed correctly, id>K dropped, and feeds encode_mask_channels to the 8*(K+1)=56 channels. README + docs/tasks.md 3.7 updated (upstream label-map generation via SAM/tracking is dataset-specific and still out of scope). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.