Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nemo_rl/models/generation/vllm/vllm_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ def reset_prefix_cache(self):
"reset_prefix_cache can only be used with async_engine=False. Use reset_prefix_cache_async instead."
)

self.llm.llm_engine.reset_prefix_cache()
self.llm.llm_engine.reset_prefix_cache(reset_connector=True)
gc.collect()
torch.cuda.empty_cache()

Expand All @@ -1285,7 +1285,7 @@ def sleep(self):
)

# Reset the prefix cache to ensure that prefix cache is not reused after weights are updated
self.llm.llm_engine.reset_prefix_cache()
self.llm.llm_engine.reset_prefix_cache(reset_connector=True)
# Clear the renderer's multimodal processor cache (sender side) so it
# stays in sync with the receiver cache that vLLM clears internally
# during sleep. Without this, the sender thinks images are already
Expand Down
11 changes: 9 additions & 2 deletions nemo_rl/models/generation/vllm/vllm_worker_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ def _create_engine(self, llm_kwargs: dict[str, Any]) -> None:
)
llm_kwargs["compilation_config"] = CompilationConfig(**compilation_config)

if isinstance(llm_kwargs.get("kv_transfer_config"), dict):
from vllm.config import KVTransferConfig

llm_kwargs["kv_transfer_config"] = KVTransferConfig(
**llm_kwargs["kv_transfer_config"]
)

self.llm_async_engine_args = AsyncEngineArgs(**llm_kwargs)
self.stat_loggers = (
[PrometheusStatLogger]
Expand Down Expand Up @@ -1459,7 +1466,7 @@ async def reset_prefix_cache_async(self):
"reset_prefix_cache_async can only be used with async_engine=True. Use reset_prefix_cache instead."
)

await self.llm.reset_prefix_cache()
await self.llm.reset_prefix_cache(reset_connector=True)
gc.collect()
torch.cuda.empty_cache()

Expand All @@ -1475,7 +1482,7 @@ async def sleep_async(self):
)

# Reset the prefix cache to ensure that prefix cache is not reused after weights are updated
await self.llm.reset_prefix_cache()
await self.llm.reset_prefix_cache(reset_connector=True)
# Reset the multimodal processor cache (sender side) so it stays in
# sync with the receiver cache that vLLM clears internally during
# sleep. Without this, the sender thinks images are already cached on
Expand Down
Loading