Support clear mm and encoder cache (#33452)

Signed-off-by: Roger Wang <hey@rogerw.io>
Co-authored-by: Roger Wang <hey@rogerw.io>
This commit is contained in:
jma99_2333
2026-01-31 15:22:25 +00:00
committed by GitHub
co-authored by Roger Wang
parent 13b842f271
commit 22d9a056d5
15 changed files with 212 additions and 1 deletions
+8
View File
@@ -720,6 +720,14 @@ class GPUModelRunner(
if self.mm_budget:
self.mm_budget.reset_cache()
def reset_encoder_cache(self) -> None:
"""Clear the GPU-side encoder cache storing vision embeddings.
This should be called when model weights are updated to ensure
stale embeddings computed with old weights are not reused.
"""
self.encoder_cache.clear()
@torch.inference_mode()
def init_fp8_kv_scales(self) -> None:
"""