diff --git a/python/sglang/srt/managers/scheduler.py b/python/sglang/srt/managers/scheduler.py index f876847e1d..47f0b7d441 100644 --- a/python/sglang/srt/managers/scheduler.py +++ b/python/sglang/srt/managers/scheduler.py @@ -919,7 +919,7 @@ def process_batch_result_decode(self, batch: ScheduleBatch, result): self.token_to_kv_pool.free_group_end() self.forward_ct_decode = (self.forward_ct_decode + 1) % (1 << 30) - if self.tp_rank == 0 and self.forward_ct_decode % 40 == 0: + if self.tp_rank == 0 and self.forward_ct_decode % self.server_args.decode_log_interval == 0: self.print_decode_stats() def add_logprob_return_values( diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index 7d23cb8bd5..501c2e326d 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -63,6 +63,7 @@ class ServerArgs: stream_interval: int = 1 random_seed: Optional[int] = None constrained_json_whitespace_pattern: Optional[str] = None + decode_log_interval: int = 40 # Logging log_level: str = "info" @@ -436,6 +437,12 @@ def add_cli_args(parser: argparse.ArgumentParser): default=ServerArgs.watchdog_timeout, help="Set watchdog timeout in seconds. If a forward batch takes longer than this, the server will crash to prevent hanging.", ) + parser.add_argument( + "--decode-log-interval", + type=int, + default=ServerArgs.decode_log_interval, + help="The log interval of decode batch" + ) # Data parallelism parser.add_argument(