[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

@@ -130,7 +130,7 @@ class ARDiffusionKVState:
if ctx.commit_current and ctx._allocated_video:
n_chunks = ctx.seq_len // self.kv_cache.spec.chunk_size
for _ in range(n_chunks):
ctx.adapter.on_chunk_committed()
self.kv_cache.commit_chunk(ctx.adapter)
self._committed[kv_branch] += ctx.seq_len
_log.debug(
"AR-Diffusion COMMIT [%s] new_tokens=%d chunks=%d resident=%d/%d",
@@ -173,6 +173,17 @@ class ARDiffusionKVState:
for i in range(self.num_layers)
]
def clear_cross_attention(self) -> None:
"""Invalidate all named cross-attention caches without dropping self-KV.
Prompt changes may preserve the autoregressive world history while
requiring fresh text projections. This operation deliberately leaves
branch adapters and their resident self-attention blocks untouched.
"""
if self._closed:
raise RuntimeError(f"AR-Diffusion session {self.session_id!r} is closed")
self.kv_cache.release_cross_attention(self.session_id)
def close(self) -> None:
"""Release all self- and cross-attention storage owned by this session."""
if self._closed: