Repository navigation
[Lingbot World] Bound image condition storage and extend temporal RoPE - #6838
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
This PR appears to belong to: docs/design/module/diffusion/diffusion_model_integration.md. Module owners: @fhfuih @Bounty-hunter @wtomin @RuixiangMa @wtz2333, please review your own changes and leave a short self-review comment describing what you checked. PRs without author self-review may not be assigned a reviewer. Please take a look when you have a chance. If you would like an automated review, mention @vllm-omni-review-bot in a comment. |
Omni ReviewBot triage noteResolved as of |
9f58632 to
763be19
Compare
Signed-off-by: wtz2333 <2955110911@qq.com>
Signed-off-by: wtz2333 <2955110911@qq.com>
Signed-off-by: wtz2333 <2955110911@qq.com>
Signed-off-by: wtz2333 <2955110911@qq.com>
Signed-off-by: wtz2333 <2955110911@qq.com>
Signed-off-by: wtz2333 <2955110911@qq.com>
7c65eac to
142ff5d
Compare
|
Two remaining entrypoint limits found at
Both entrypoint issues were reproduced on CPU without model weights. |
…limits Signed-off-by: wtz2333 <2955110911@qq.com>
Fixed it |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8adcb9449c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -191,8 +190,6 @@ def build_request( | |||
| raise ValueError("--height * --width must not exceed 480 * 832 pixels.") | |||
| if args.num_frames <= 0: | |||
| raise ValueError("--num-frames must be a positive integer.") | |||
There was a problem hiding this comment.
Update the shipped recipe after lifting the frame cap
When requests above 117 frames are accepted here, the canonical recipes/Robbyant/LingBot-World-2.0.md:50-53 instructions become incorrect: they still state that raw frame counts are capped at 117. Users following the model recipe will therefore avoid the longer offline rollouts this change explicitly enables, so the documented limit should be removed or replaced with the actual remaining constraints.
Useful? React with 👍 / 👎.
Signed-off-by: wtz2333 <2955110911@qq.com>
… a fixed point Since vllm-project#6838 a realtime session runs the causal Wan encoder on every AR block to produce that block's image condition: three passes of the encoder plus the posterior projection, 178 ms of a 1325 ms chunk at 480x832 on 4xH200. After the opening block the pixel input to those passes is always the same all-zero frames, so the only thing that can change the result from one block to the next is the encoder's own history. That history is a causal cache with finite temporal reach. Once the zero frames have flushed the source image out of it, the encoder is at a fixed point: identical input and identical state give the same output and the same state on every later block. Detect that rather than assume it: a block whose returned history is bit-identical to the history it was given is the proof, and from then on the session reuses its stored condition and the encoder is not run. It is exactly lossless by construction, and the whole-clip encode remains the reference every block is checked against in the tests. On the served path the fixed point arrives by the eleventh block and 40-block rollouts are byte-identical before and after. The fixed point is per session and is dropped with the session's encoder history, so a restart from a new source image encodes again until it settles. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
… a fixed point Since vllm-project#6838 a realtime session runs the causal Wan encoder on every AR block to produce that block's image condition: three passes of the encoder plus the posterior projection, 178 ms of a 1325 ms chunk at 480x832 on 4xH200. After the opening block the pixel input to those passes is always the same all-zero frames, so the only thing that can change the result from one block to the next is the encoder's own history. That history is a causal cache with finite temporal reach. Once the zero frames have flushed the source image out of it, the encoder is at a fixed point: identical input and identical state give the same output and the same state on every later block. Detect that rather than assume it: a block whose returned history is bit-identical to the history it was given is the proof, and from then on the session reuses its stored condition and the encoder is not run. It is exactly lossless by construction, and the whole-clip encode remains the reference every block is checked against in the tests. On the served path the fixed point arrives by the eleventh block and 40-block rollouts are byte-identical before and after. The fixed point is per session and is dropped with the session's encoder history, so a restart from a new source image encodes again until it settles. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
vllm-project#6838) Signed-off-by: wtz2333 <2955110911@qq.com> Signed-off-by: Matthieu Laneuville <matthieu.laneuville@surf.nl>
vllm-project#6838) Signed-off-by: wtz2333 <2955110911@qq.com>
Purpose
Condition. Realtime and stepwise generation previously stopped after ten blocks because the image condition covered only 117 pixel frames (30 latent frames). This PR advances a session-owned causal Wan VAE encoder to produce each three-latent-frame condition block from the initial image followed by zero pixel frames. Carrying the encoder history forward preserves the evolving causal context, including the initial image's contribution to later blocks. The implementation retains one current condition block and bounded encoder histories, removes the request/example caps, and accounts for committed and in-flight state in session admission.
RoPE. The transformer also rejected temporal positions beyond its precomputed RoPE table (1024 latent frames by default). Cached positions keep using the existing table; blocks crossing or exceeding it compute only their own temporal cos/sin values using absolute positions and the original frequencies. The table stays fixed in size, and spatial limits remain unchanged.
These model-side changes follow RFC #7074. Condition encoding requires the unpatched, non-tiled Wan encoder. Shared paged-KV length handling and metadata compaction remain a separate follow-up: at 480×832, the default
1 << 20token limit is reached during the 225th generation block. This PR does not claim unbounded end-to-end realtime generation.What Changes
vllm_omni/diffusion/models/lingbot_world/pipeline.pyvllm_omni/diffusion/models/lingbot_world/transformer.pyexamples/offline_inference/diffusion/lingbot_world_v2.pyexamples/offline_inference/diffusion/lingbot_world_v2_realtime.pytests/diffusion/models/lingbot_world/test_pipeline_lingbot_world.pytests/diffusion/models/lingbot_world/test_lingbot_world_transformer.pydocs/design/feature/realtime_ar_diffusion.mdTest Plan
vLLM Version: 0.29.0
vLLM-Omni Commit: main
db40ed3a3179d9125408dce9c89f1c97b5a5d03avs current142ff5dcac382cb9d65909120be8846c7ac7e22f, based on the same main commit. The separate KV fix is excluded.Environment: one H200, PyTorch 2.13.0+cu130, diffusers 0.38.0, transformers 5.14.1; 832×480, BF16, TP1, eager, FLASH_ATTN, batch/concurrency 1, four DMD steps, flow shift 5, seed 42.
All checks use the same lakeside image/prompt. Each camera event has an increasing
event_idand three action lists, e.g.{"event_id": 0, "frames": [["d"], ["d"], ["d"]]}. Short runs use tendevents; the long run alternates 20devents with 20aevents.At this resolution, each latent frame consumes 1560 tokens. The default shared KV limit (
1 << 20) is reached in block 225, before the RoPE crossing in block 342 (zero-based index 341, temporal positions 1023–1025). The long test therefore uses an isolated copy of the current commit with onlymax_model_len=1 << 21added to LingBot'sARDiffusionKVCacheSpec. This experiment-only override is not part of the PR; 344 blocks require 1,609,920 tokens. It isolates RoPE behavior and cannot establish that the default shared-KV limit has been removed.The existing entrypoint below exercises the short configuration.
$INPUT_IMAGE,$PROMPT,$EVENTS_JSONL, and$OUTPUT_DIRare caller-supplied. The original image/prompt are not bundled in this PR, so replacement inputs reproduce the procedure rather than the exact numerical results. The example saves latent chunks; video decoding/export is a separate step. The long diagnostic additionally requires the stated KV override and 344 events.Test Result
480p numerical equality
All ten latent chunks are exactly equal across main → current → main: maximum absolute difference and RMSE are both 0. All 30 outputs are finite and have the expected shape. This covers one image/prompt and control sequence. The 117-frame main/current videos also have exactly matching float RGB values and MP4 bytes; the side-by-side video contains 117 frames at 16 FPS (1664×480).
comparison.mp4
480p long rollout / RoPE boundary
1 << 21The current stateful encoder completed 344 continuous chunks (1032 latent frames), producing a validated 4125-frame video at 832×480 and 16 FPS (257.8125 seconds). Every latent chunk was finite with the expected shape and consecutive event IDs. Chunk index 341 covers temporal positions 1023–1025 and crosses the original 1024-position RoPE table; chunks 342 and 343 also completed, ending at position 1031. The existing streaming Wan decoder maintained one continuous state across the full video.
This verifies the tested RoPE crossing with the experiment-only shared KV cap raised to
1 << 21. The default KV cap remains unchanged in the PR; this result does not establish unbounded default-configuration generation or long-video perceptual quality.480p chunk latency
Times are milliseconds. Main is the mean of its two runs; current has one run. Request latency is the sum of ten
session.next_chunk()wall-clock measurements, excluding model loading, between-chunk saving, VAE decoding, and MP4 encoding. Subsequent chunks have changing context lengths and are not independent steady-state repeats.All three runs succeeded. Main's full-request totals were 27,836.25 and 27,056.17 ms (2.84% spread), so the +0.46% total difference is within observed baseline variation. Its subsequent-nine-chunk totals differed by only 0.124%; current adds 171–185 ms per subsequent chunk, averaging 179 ms.
Why the latency shifts. Main prepares all 117 condition pixel frames in the first chunk: 30 Wan encoder forwards, followed by condition slicing in later chunks. Current performs three encoder forwards per chunk: nine opening pixel frames, then twelve fresh pixel frames per subsequent chunk, carrying causal history across calls. The first chunk therefore avoids 27 encoder forwards, while each later chunk performs work that main already prepaid. Both paths perform 30 encoder forwards over this ten-chunk workload. The observed first-chunk reduction and later increase are consistent with this redistribution; exact per-stage attribution has not been measured.
This is not an additional condition/KV writeback pass. Committing
encoder_cachereplaces a Python reference, and preparing the pending cache shallow-copies a list rather than cloning all tensors. Wan's internal feature-cacheclone/catoperations still run as part of encoding; main performed those operations during its initial full encode. The existing four denoising forwards plus the fifth clean-latent KV-commit forward are unchanged. Additional per-chunk projection, normalization, allocation, and cache lifetime may contribute, but their individual costs are unmeasured. The short test never reaches the RoPE extension path.Process wall times including startup/shutdown were 101,410 / 78,422 / 75,004 ms in A/B/A order; model loading alone was 19,714 / 17,588 / 16,865 ms. Startup variation is not treated as an inference speedup. All three reported 77.18 GiB of process GPU memory after loading, not peak memory. Both revisions admitted one session after automatic KV-budget adjustment. This is an exploratory comparison, not a steady-state or tail-latency benchmark.
CPU checks: 286 passed, 3 deselected. Ruff lint/format checks and
git diff --checkpassed.**BEFORE SUBMITTING:**read CONTRIBUTING.md and run the precheck-pr skill with the code agent for a self-check against project conventions.
(anything written below this line will be removed by GitHub Actions)