Skip to content

Commit

Permalink
Expose decode log interval
Browse files Browse the repository at this point in the history
  • Loading branch information
ByronHsu committed Oct 31, 2024
1 parent 2d4ce1b commit 137c648
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/sglang/srt/managers/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions python/sglang/srt/server_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 137c648

Please sign in to comment.