[feat] Add LingBot-World v2 causal-fast streaming support#11
Merged
Conversation
- add an encoder cache state alongside the existing streaming decoder state\n- encode first and subsequent temporal chunks incrementally with cache ownership kept by the caller\n- reset encoder cache state after the final chunk\n\nVerification:\n- .venv/bin/python -m pytest tests/unit/pipelines/lingbot_world_fast tests/unit/pipelines/lingbot_world_v2 -q\n- .venv/bin/python -m compileall -q examples/lingbot telefuser/pipelines/lingbot_world_fast/service.py\n- git diff --check
- match source image preprocessing, VAE precision, timestep selection, and checkpoint validation\n- generate noise and VAE conditioning incrementally instead of retaining duration-sized chunk lists\n- derive completion from the chunk boundary and centralize frame alignment policy\n- move stream defaults into PPL configuration while preserving service-side session defaults\n- cover preprocessing parity, runtime lifecycle, and service action loop behavior\n\nVerification:\n- .venv/bin/python -m pytest tests/unit/pipelines/lingbot_world_fast tests/unit/pipelines/lingbot_world_v2 -q\n- .venv/bin/python -m compileall -q examples/lingbot telefuser/pipelines/lingbot_world_fast/service.py\n- git diff --check
- add a v2 facade that validates the public checkpoint layout and camera-only control projection\n- provide v2 offline and four-GPU streaming examples with v2 PPL defaults\n- set the v2 streaming duration ceiling to two minutes while preserving the shared service behavior\n- document the shared streaming-state ownership and fixed offline frame presets\n- cover v2 PPL mapping, service defaults, and offline CLI forwarding\n\nVerification:\n- .venv/bin/python -m pytest tests/unit/pipelines/lingbot_world_fast tests/unit/pipelines/lingbot_world_v2 -q\n- .venv/bin/python -m compileall -q examples/lingbot telefuser/pipelines/lingbot_world_fast/service.py\n- four-GPU offline v2 smoke generation completed\n- git diff --check
- hide redundant generation and control tuning fields from the browser page\n- stop forwarding client-side LingBot defaults so the service PPL configuration is authoritative\n- preserve optional browser FPS forwarding when explicitly configured\n\nVerification:\n- .venv/bin/python examples/stream_server/webrtc_bidirectional_demo.py --help\n- launched the demo against the four-GPU LingBot v2 stream service\n- git diff --check
- announce LingBot-World v2 support with the upstream project link\n- point English and Chinese quick-start commands to the v2 streaming service\n- refresh the LingBot example guide for v2 offline generation, WebRTC interaction, and multi-GPU inference\n\nVerification:\n- git diff --check\n- checked v1 example command references are absent from the updated READMEs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds LingBot-World v2 support by introducing a v2 pipeline facade on top of the shared LingBot “causal-fast” runtime, while refactoring the shared runtime to generate/encode incrementally per chunk (reducing long-session memory growth) and updating streaming/offline examples plus documentation.
Changes:
- Introduce
LingBotWorldV2Pipeline+ public-checkpoint validation and add v2 offline + 4-GPU bidirectional streaming examples. - Refactor LingBot causal-fast runtime to be chunk-incremental (noise generation + VAE conditioning encode cache), add
frame_policy, and make timestep selection configurable/validated. - Simplify the WebRTC demo and update English/Chinese READMEs + project documentation notes.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/pipelines/lingbot_world_v2/test_service.py | Adds unit tests validating v2 example/service wiring and CLI forwarding. |
| tests/unit/pipelines/lingbot_world_fast/test_service_action_loop.py | Updates action-loop test expectations for new done semantics. |
| tests/unit/pipelines/lingbot_world_fast/test_runtime_baseline.py | Updates baseline runtime tests for incremental noise/condition handling and v1/v2 shared contracts. |
| tests/unit/pipelines/lingbot_world_fast/test_pipeline_call.py | Updates pipeline-call tests to use session status (RELEASED) and done completion. |
| telefuser/service/api/stream_schema.py | Changes WebRTC offer request fps default to None. |
| telefuser/pipelines/lingbot_world_v2/pipeline.py | Adds v2 pipeline facade + checkpoint layout/shape validation. |
| telefuser/pipelines/lingbot_world_v2/init.py | Exports v2 pipeline symbols. |
| telefuser/pipelines/lingbot_world_fast/session.py | Adds frame_policy, per-session noise generator + VAE encoder cache state, and chunk_count property. |
| telefuser/pipelines/lingbot_world_fast/service.py | Adds session default config plumbing, duration-based frame calculation, and max_generation_seconds enforcement. |
| telefuser/pipelines/lingbot_world_fast/pipeline.py | Refactors image preprocessing, per-chunk condition encoding, per-chunk noise generation, and timestep plumbing. |
| telefuser/pipelines/lingbot_world_fast/denoising.py | Adds validated timestep selection and autocast around DiT calls. |
| telefuser/pipelines/lingbot_world_fast/control.py | Simplifies deferred control handling to plain callables. |
| telefuser/pipelines/lingbot_world_fast/init.py | Updates exports after timesteps refactor. |
| telefuser/models/wan_video_vae.py | Adds session-owned incremental VAE encode cache + cached encode method. |
| telefuser/models/lingbot_world_fast_dit.py | Tightens checkpoint validation/loading, adjusts dtype handling and output casting. |
| README.md | Updates news and streaming demo docs to reference LingBot-World v2. |
| README_zh.md | Chinese README updates mirroring v2 additions. |
| examples/stream_server/webrtc_bidirectional_demo.py | Removes browser-side LingBot parameter controls and stops always sending fps. |
| examples/lingbot/stream_lingbot_world_v2.py | Adds v2 streaming service example with PPL-configured defaults + 2-minute cap. |
| examples/lingbot/stream_lingbot_world_fast.py | Updates v1 streaming example to use service-side defaults config. |
| examples/lingbot/README.md | Updates LingBot examples README to cover v1 + v2 and fixed frame counts per PPL config. |
| examples/lingbot/lingbot_world_v2_image_to_video_h100.py | Adds v2 offline camera-controlled example + CLI. |
| examples/lingbot/lingbot_world_fast_image_to_video_h100.py | Updates v1 offline example to align with new session config defaults and removes CLI frame_num override. |
| CLAUDE.md | Documents LingBot streaming state constraints and adds pipeline directory entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- preserve explicitly supplied zero values instead of falling back through truthiness defaults\n- reject non-positive FPS, chunk size, and duration before frame-count calculation\n- guard the duration-to-frame helper against invalid direct callers\n- cover zero and negative client parameters, including explicit frame-count requests\n\nVerification:\n- .venv/bin/python -m pytest tests/unit/pipelines/lingbot_world_fast/test_service_action_loop.py tests/unit/pipelines/lingbot_world_v2/test_service.py -q\n- .venv/bin/python -m compileall -q telefuser/pipelines/lingbot_world_fast/service.py tests/unit/pipelines/lingbot_world_fast/test_service_action_loop.py\n- git diff --check
- write the effective truncate-policy frame count back to the shared session configuration\n- normalize explicit service frame requests before duration validation\n- keep control truncation, latent chunk counts, and service duration checks aligned\n- cover runtime and service regressions for a 13-frame request truncated to 9 frames\n\nVerification:\n- .venv/bin/python -m pytest tests/unit/pipelines/lingbot_world_fast/test_service_action_loop.py tests/unit/pipelines/lingbot_world_fast/test_runtime_baseline.py tests/unit/pipelines/lingbot_world_v2/test_service.py -q\n- .venv/bin/python -m compileall -q telefuser/pipelines/lingbot_world_fast/service.py tests/unit/pipelines/lingbot_world_fast/test_service_action_loop.py\n- git diff --check
Resolve WebRTC media-track FPS from an explicit request value or the underlying stream service default_fps, rather than forcing 24 FPS when the request omits it. Keep absent FPS out of session configuration so LingBot PPL defaults remain authoritative.\n\nAdd server-push and bidirectional route regressions for service-provided FPS defaults.\n\nVerification:\n- .venv/bin/python -m pytest tests/unit/service/test_service_routes.py tests/unit/pipelines/lingbot_world_fast/test_service_action_loop.py tests/unit/pipelines/lingbot_world_v2/test_service.py -q\n- git diff --check
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.
Description
Add LingBot-World v2 support on top of the shared causal-fast runtime, including offline image-to-video generation, four-GPU bidirectional WebRTC streaming, and v2-focused documentation.
Motivation
LingBot-World v2 uses a different public checkpoint layout and causal-fast defaults from v1. This PR integrates v2 without duplicating the runtime, aligns shared inference behavior with the reference implementation, and reduces streaming memory growth for long sessions.
Type of Change
Changes Made
LingBotWorldV2Pipelinewith public checkpoint validation, camera-control enforcement, offline v2 example, and four-GPU v2 streaming example.chunk_size=4, and a two-minute session limit.Testing
Test commands:
.venv/bin/python -m pytest tests/unit/pipelines/lingbot_world_fast tests/unit/pipelines/lingbot_world_v2 -q # 61 passed .venv/bin/python -m compileall -q \ examples/lingbot \ telefuser/pipelines/lingbot_world_fast/service.py git diff --checkManual validation:
Checklist
ruff)pre-commit run --all-filesnot run)pytest tests/not run)[TYPE] Brief descriptionRelated Issues
N/A
Additional Notes
chunk_size=4, this resolves to 1917 output frames (119.75 seconds) to preserve complete latent chunks.GPU Architecture Support
Performance Impact
Long-running LingBot sessions no longer retain duration-sized noise and VAE condition chunk lists. Conditioning VAE encoding is incremental and cache state is session-owned, reducing session memory growth and preserving isolation between concurrent sessions.