[Core] Add realtime AR-Diffusion tick sessions for LingBot World 2.0 (#5491)

Signed-off-by: zhangbin.327 <zhangbin.327@bytedance.com>
Signed-off-by: Jack47 <scsvip@gmail.com>
Co-authored-by: zhangbin.327 <zhangbin.327@bytedance.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-08-16 09:11:20 +08:00
1 parent 9798bc3a8d
commit 3875f8ded4
53 files changed
+10754 -129

No files matched your search

@@ -58,6 +58,9 @@ class ARDiffusionKVCacheSpec:
``max_scratch_tokens_per_branch`` is the maximum non-video KV (for example,
action/state registers) that must coexist with an uncommitted video block.
``model_owned_state_bytes_per_session`` is a conservative upper bound for
persistent per-session CUDA state outside runner-owned self/cross-attention
KV and scratch pools.
``session_capacity`` is the pipeline's upper bound; a runner may retain
fewer sessions when its current memory and execution policy is stricter.
@@ -79,6 +82,7 @@ class ARDiffusionKVCacheSpec:
cross_attention: tuple[ARDiffusionCrossAttentionKVSpec, ...] = ()
max_model_len: int = 1 << 20
max_scratch_tokens_per_branch: int = 0
model_owned_state_bytes_per_session: int = 0
def __post_init__(self) -> None:
positive_fields = {
@@ -101,6 +105,11 @@ class ARDiffusionKVCacheSpec:
"AR-Diffusion max_scratch_tokens_per_branch must be non-negative, "
f"got {self.max_scratch_tokens_per_branch}"
)
if self.model_owned_state_bytes_per_session < 0:
raise ValueError(
"AR-Diffusion model_owned_state_bytes_per_session must be non-negative, "
f"got {self.model_owned_state_bytes_per_session}"
)
if not self.kv_branches:
raise ValueError("AR-Diffusion requires at least one KV branch")
kv_branch_names = [kv_branch.name for kv_branch in self.kv_branches]