Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ def generate(
results.append(result_item)
except Exception as e:
logger.error(
"Failed to generate output for prompt %d: %s", request_idx + 1, e
"Failed to generate output for prompt %d: %s",
request_idx + 1,
e,
exc_info=True,
)
continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ def forward(

if num_timesteps > 0:
self.log_info(
"Average time per step: %.4f seconds",
"average time per step: %.4f seconds",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other log messages in the codebase, it's better to start log messages with a capital letter. Many other log_info calls in the project follow this convention (e.g., logger.info("Stopping Profiler...")).

Suggested change
"average time per step: %.4f seconds",
"Average time per step: %.4f seconds",

(denoising_end_time - denoising_start_time) / len(timesteps),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def forward(
denoising_loop_end_time = time.time()
if len(timesteps) > 0:
self.log_info(
"Average time per step: %.4f seconds",
"average time per step: %.4f seconds",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency across the project, log messages should start with a capital letter. This change introduces an inconsistency with other log messages in the codebase.

Suggested change
"average time per step: %.4f seconds",
"Average time per step: %.4f seconds",

(denoising_loop_end_time - denoising_loop_start_time) / len(timesteps),
)

Expand Down
12 changes: 3 additions & 9 deletions python/sglang/multimodal_gen/runtime/utils/perf_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import subprocess
import sys
import time
import traceback
from datetime import datetime
from functools import lru_cache
from pathlib import Path
Expand All @@ -16,6 +15,7 @@

import sglang
import sglang.multimodal_gen.envs as envs
from sglang.multimodal_gen.runtime.utils.logging_utils import _SGLDiffusionLogger


@dataclasses.dataclass
Expand Down Expand Up @@ -123,15 +123,14 @@ class StageProfiler:
def __init__(
self,
stage_name: str,
logger: logging.Logger,
logger: _SGLDiffusionLogger,
timings: Optional["RequestTimings"],
simple_log: bool = False,
):
self.stage_name = stage_name
self.timings = timings
self.logger = logger
self.simple_log = simple_log
self.logger = logging.getLogger(__name__)
self.start_time = 0.0

# Check env var at runtime to ensure we pick up changes (e.g. from CLI args)
Expand All @@ -158,13 +157,8 @@ def __exit__(self, exc_type, exc_val, exc_tb):
self.stage_name,
execution_time_s * 1000,
exc_val,
exc_info=True,
)
if self.metrics_enabled:
self.logger.error(
"[%s] Traceback: %s",
self.stage_name,
"".join(traceback.format_tb(exc_tb)),
)
return False

if self.simple_log:
Expand Down
Loading