Skip to content

[Models] Add LongSANA Runtime V2 text-to-video pipeline - #591

Open
jmccaffrey-nv wants to merge 2 commits into
mainfrom
dev/jmccaffrey/long-sana
Open

[Models] Add LongSANA Runtime V2 text-to-video pipeline#591
jmccaffrey-nv wants to merge 2 commits into
mainfrom
dev/jmccaffrey/long-sana

Conversation

@jmccaffrey-nv

@jmccaffrey-nv jmccaffrey-nv commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add the LongSANA 2B 480p self-forcing text-to-video pipeline on Runtime V2.
  • Reuse SANA-WM prompt/model components and the shared Wan VAE while implementing the LongSANA constant-memory recurrent attention cache.
  • Keep first/steady block sizing session-local and reject rollouts beyond the released 1024-position RoPE table before model setup.
  • Add checkpoint/config validation, diverse-prompt benchmarks, operator profiling, tests, usage docs, and a staged flashdreams.accelerated scope.

Validation

  • 17 LongSANA tests passed; full pre-commit lint, format, type, lockfile, and metadata checks passed.
  • Strictly loaded all 418 tensors in the 2.06B-parameter public checkpoint and completed Runtime V2 GPU validation.
  • Fresh two-block run produced 81 finite 832x480 frames, held the recurrent cache at 152.526855 MiB, and was byte-identical to the reviewed baseline.
  • Five-case evaluation generated 565 finite frames; RTX PRO 6000 baseline is 9.93 output FPS end-to-end and 19.86 FPS for DiT plus cache commit.

@copy-pr-bot

copy-pr-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a packaged Runtime V2 LongSANA 2B text-to-video integration with recurrent session-local attention state, model and scheduler implementations, shared Wan VAE decoding, application registration, validation tooling, tests, and operational documentation. Changes since the previous review:

  • Move active autoregressive block length into each session’s transformer cache, eliminating the shared block-index race.
  • Validate the 1024-position RoPE rollout limit before generation.
  • Add acceleration planning and associated benchmark guidance.
  • Cast Wan decoder inputs to the configured decoder dtype.

Confidence Score: 5/5

The PR appears safe to merge; the previously outstanding rollout-limit defect is fixed and no new actionable failures were found.

The rollout limit is now validated before model setup and again when a cache starts a block, while active frame counts are session-local and correctly drive noise generation. The earlier shared-index thread was manually resolved without explanation; the current implementation independently removes that shared mutable state. No blocking or non-blocking new findings remain.

Important Files Changed

Filename Overview
integrations_v2/longsana/impl/transformer.py Implements session-local block sizing, recurrent cache lifecycle, checkpoint loading, and early RoPE-bound validation; the concurrency fix is consistent with the shared runtime call order.
integrations_v2/longsana/impl/model.py Defines the checkpoint-compatible recurrent LongSANA network and its absolute-position RoPE implementation.
integrations_v2/longsana/apps/t2v/adapter.py Registers native application defaults and now rejects unsupported rollout lengths during application initialization.
integrations_v2/longsana/impl/pipeline.py Connects prompt encoding, diffusion, decoder, and per-session transformer state without retaining the former shared autoregressive index.
flashdreams/flashdreams/recipes/wan/autoencoder/vae.py Converts incoming latents to the configured VAE dtype before streaming decode.
integrations_v2/longsana/pyproject.toml Packages the integration, bundled text configuration, workspace dependencies, and Runtime V2 application entry point.
integrations_v2/longsana/tests/test_smoke.py Covers recurrent-state stability, numerical contracts, interleaved session block shapes, and direct-cache RoPE overflow.
integrations_v2/longsana/tests/test_t2v_app.py Verifies public defaults, native resolution, entry-point registration, and maximum rollout validation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    P[Prompt] --> E[Gemma / CHI prompt encoder]
    E --> C[Session-local conditioning and recurrent cache]
    C --> D[LongSANA recurrent DiT]
    D --> S[Four-step flow scheduler]
    S --> F[Clean cache-commit forward]
    F --> C
    S --> L[Denoised latent block]
    L --> V[Streaming Wan VAE decoder]
    V --> O[Runtime V2 video frames]
Loading

Reviews (2): Last reviewed commit: "Fix LongSANA session isolation and rollo..." | Re-trigger Greptile

Comment thread integrations_v2/longsana/impl/pipeline.py Outdated
Comment on lines +513 to +517
if max(end_frame, height, width) > max_sequence_length:
raise ValueError(
"LongSana RoPE position exceeds the released 1024-position table: "
f"end_frame={end_frame}, height={height}, width={width}."
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Long Rollouts Fail Late

The application accepts any positive --total-blocks value, but this code rejects absolute positions beyond 1024. Since the first block contains 11 latent frames and every later block contains 10, a request for 103 or more blocks passes initial validation and fails only after a long partial rollout. Validate the maximum block count before generation begins, or support positions beyond 1024.

Knowledge Base Used:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8899b65: the shared 1024-position constant derives a 102-block maximum, the app rejects 103+ before model setup, and the per-session cache also guards direct callers. Boundary tests cover 102 accepted and 103 rejected.

@jmccaffrey-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 63053a2

@jmccaffrey-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 8899b65

1 similar comment
@jmccaffrey-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 8899b65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant