[diffusion] feat: support lightweight e2e warmup for benchmarking (#16213)

This commit is contained in:
Mick
2026-01-02 20:10:27 +08:00
committed by GitHub
parent 698629d1f2
commit 5062537b67
15 changed files with 205 additions and 135 deletions
@@ -466,7 +466,10 @@ def log_generation_timer(
yield timer
timer.end_time = time.perf_counter()
timer.duration = timer.end_time - timer.start_time
logger.info("Pixel data generated successfully in %.2f seconds", timer.duration)
logger.info(
f"Pixel data generated successfully in {GREEN}%.2f{RESET} seconds",
timer.duration,
)
except Exception as e:
if request_idx is not None:
logger.error(
@@ -487,7 +490,7 @@ def log_batch_completion(
logger: logging.Logger, num_outputs: int, total_time: float
) -> None:
logger.info(
"Completed batch processing. Generated %d outputs in %.2f seconds.",
f"Completed batch processing. Generated %d outputs in {GREEN}%.2f{RESET} seconds",
num_outputs,
total_time,
)
@@ -33,6 +33,10 @@ class RequestTimings:
self.steps: list[float] = []
self.total_duration_ms: float = 0.0
@property
def total_duration_s(self) -> float:
return self.total_duration_ms / 1000.0
def record_stage(self, stage_name: str, duration_s: float):
"""Records the duration of a pipeline stage"""
self.stages[stage_name] = duration_s * 1000 # Store as milliseconds