[Kimi Bug] Fix k3 torch.AcceleratorError: CUDA error: an illegal memory access was encountered (#53773)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye
2026-08-25 17:38:48 -07:00
committed by GitHub
parent bc2d63e650
commit a447955aca
+2
View File
@@ -845,6 +845,8 @@ def _teardown_profiling_state(runner: "GPUModelRunner") -> None:
"""Release the profiling KV cache and captured graphs while keeping model
weights, so the real ``initialize_kv_cache`` starts from a clean slate."""
torch.accelerator.synchronize()
if hasattr(runner.model_state, "_mamba_ctx"):
runner.model_state._mamba_ctx = None
if hasattr(runner, "kv_caches"):
runner.kv_caches.clear()
if hasattr(runner, "attn_groups"):