Skip to content
Merged
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
9 changes: 9 additions & 0 deletions python/sglang/srt/managers/tokenizer_communicator_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,12 @@ def _get_communicator_dispatcher(self: TokenizerManager):
)

async def flush_cache(self: TokenizerManager) -> FlushCacheReqOutput:
self.auto_create_handle_loop()
return (await self.flush_cache_communicator(FlushCacheReqInput()))[0]

async def clear_hicache_storage(self: TokenizerManager) -> ClearHiCacheReqOutput:
"""Clear the hierarchical cache storage."""
self.auto_create_handle_loop()
# Delegate to the scheduler to handle HiCacheStorage clearing
return (await self.clear_hicache_storage_communicator(ClearHiCacheReqInput()))[
0
Expand All @@ -361,6 +363,7 @@ async def attach_hicache_storage(
hicache_write_policy: Optional[str] = None,
) -> AttachHiCacheStorageReqOutput:
"""Attach (enable) HiCache storage backend at runtime."""
self.auto_create_handle_loop()
results = await self.attach_hicache_storage_communicator(
AttachHiCacheStorageReqInput(
hicache_storage_backend=hicache_storage_backend,
Expand Down Expand Up @@ -392,6 +395,7 @@ async def detach_hicache_storage(
self: TokenizerManager,
) -> DetachHiCacheStorageReqOutput:
"""Detach (disable) HiCache storage backend at runtime."""
self.auto_create_handle_loop()
results = await self.detach_hicache_storage_communicator(
DetachHiCacheStorageReqInput()
)
Expand Down Expand Up @@ -855,6 +859,7 @@ async def slow_down(
await self.slow_down_communicator(obj)

async def get_internal_state(self: TokenizerManager) -> List[Dict[Any, Any]]:
self.auto_create_handle_loop()
req = GetInternalStateReq()
responses: List[GetInternalStateReqOutput] = (
await self.get_internal_state_communicator(req)
Expand All @@ -865,6 +870,7 @@ async def get_internal_state(self: TokenizerManager) -> List[Dict[Any, Any]]:
async def set_internal_state(
self: TokenizerManager, obj: SetInternalStateReq
) -> List[bool]:
self.auto_create_handle_loop()
responses: List[SetInternalStateReqOutput] = (
await self.set_internal_state_communicator(obj)
)
Expand All @@ -873,9 +879,11 @@ async def set_internal_state(
async def dumper_control(
self: TokenizerManager, obj: DumperControlReqInput
) -> List[DumperControlReqOutput]:
self.auto_create_handle_loop()
return await self.dumper_control_communicator(obj)

async def get_load(self: TokenizerManager) -> List[GetLoadReqOutput]:
self.auto_create_handle_loop()
req = GetLoadReqInput()
return await self.get_load_communicator(req)

Expand All @@ -894,6 +902,7 @@ async def get_loads(
Returns:
List of GetLoadsReqOutput, one per scheduler (filtered by dp_rank if specified)
"""
self.auto_create_handle_loop()
req = GetLoadsReqInput(
include=include if include else ["all"],
dp_rank=dp_rank,
Expand Down
Loading