From 4086566516a713d58466d371938a57679251560e Mon Sep 17 00:00:00 2001 From: fzyzcjy <5236035+fzyzcjy@users.noreply.github.com> Date: Sun, 18 May 2025 08:10:44 +0800 Subject: [PATCH] Fix expert distribution recorder and profiler command stuck forever (#6284) --- python/sglang/srt/managers/tokenizer_manager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/sglang/srt/managers/tokenizer_manager.py b/python/sglang/srt/managers/tokenizer_manager.py index 167c79638..53e422718 100644 --- a/python/sglang/srt/managers/tokenizer_manager.py +++ b/python/sglang/srt/managers/tokenizer_manager.py @@ -792,6 +792,7 @@ class TokenizerManager: with_stack: Optional[bool] = None, record_shapes: Optional[bool] = None, ): + self.auto_create_handle_loop() req = ProfileReq( type=ProfileReqType.START_PROFILE, output_dir=output_dir, @@ -814,16 +815,20 @@ class TokenizerManager: return result def stop_profile(self): + self.auto_create_handle_loop() req = ProfileReq(type=ProfileReqType.STOP_PROFILE) self.send_to_scheduler.send_pyobj(req) async def start_expert_distribution_record(self): + self.auto_create_handle_loop() await self.expert_distribution_communicator(ExpertDistributionReq.START_RECORD) async def stop_expert_distribution_record(self): + self.auto_create_handle_loop() await self.expert_distribution_communicator(ExpertDistributionReq.STOP_RECORD) async def dump_expert_distribution_record(self): + self.auto_create_handle_loop() await self.expert_distribution_communicator(ExpertDistributionReq.DUMP_RECORD) async def update_weights_from_disk(