Unverified Commit 544435d1 authored by yihuiwen's avatar yihuiwen Committed by GitHub
Browse files

add segments end2end latency (#360)


Co-authored-by: default avataryihuiwen <yihuiwen@sensetime.com>
parent 77f3d55e
...@@ -127,21 +127,27 @@ class DefaultRunner(BaseRunner): ...@@ -127,21 +127,27 @@ class DefaultRunner(BaseRunner):
total_steps = self.model.scheduler.infer_steps total_steps = self.model.scheduler.infer_steps
for step_index in range(total_steps): for step_index in range(total_steps):
# only for single segment, check stop signal every step # only for single segment, check stop signal every step
if self.video_segment_num == 1: with ProfilingContext4DebugL1(
self.check_stop() f"Run Dit every step",
logger.info(f"==> step_index: {step_index + 1} / {total_steps}") recorder_mode=GET_RECORDER_MODE(),
metrics_func=monitor_cli.lightx2v_run_per_step_dit_duration,
metrics_labels=[step_index + 1, total_steps],
):
if self.video_segment_num == 1:
self.check_stop()
logger.info(f"==> step_index: {step_index + 1} / {total_steps}")
with ProfilingContext4DebugL1("step_pre"): with ProfilingContext4DebugL1("step_pre"):
self.model.scheduler.step_pre(step_index=step_index) self.model.scheduler.step_pre(step_index=step_index)
with ProfilingContext4DebugL1("🚀 infer_main"): with ProfilingContext4DebugL1("🚀 infer_main"):
self.model.infer(self.inputs) self.model.infer(self.inputs)
with ProfilingContext4DebugL1("step_post"): with ProfilingContext4DebugL1("step_post"):
self.model.scheduler.step_post() self.model.scheduler.step_post()
if self.progress_callback: if self.progress_callback:
self.progress_callback(((step_index + 1) / total_steps) * 100, 100) self.progress_callback(((step_index + 1) / total_steps) * 100, 100)
return self.model.scheduler.latents return self.model.scheduler.latents
...@@ -259,8 +265,8 @@ class DefaultRunner(BaseRunner): ...@@ -259,8 +265,8 @@ class DefaultRunner(BaseRunner):
with ProfilingContext4DebugL1( with ProfilingContext4DebugL1(
f"segment end2end {segment_idx + 1}/{self.video_segment_num}", f"segment end2end {segment_idx + 1}/{self.video_segment_num}",
recorder_mode=GET_RECORDER_MODE(), recorder_mode=GET_RECORDER_MODE(),
metrics_func=monitor_cli.lightx2v_run_per_step_dit_duration, metrics_func=monitor_cli.lightx2v_run_segments_end2end_duration,
metrics_labels=[segment_idx + 1, self.video_segment_num], metrics_labels=["DefaultRunner"],
): ):
self.check_stop() self.check_stop()
# 1. default do nothing # 1. default do nothing
......
...@@ -27,6 +27,153 @@ class MetricsConfig(BaseModel): ...@@ -27,6 +27,153 @@ class MetricsConfig(BaseModel):
) )
HYBRID_10_50MS_BUCKETS = (
0.001, # 1ms
0.005, # 5ms
0.008, # 8ms
0.010, # 10ms
0.012, # 12ms
0.015, # 15ms
0.020, # 20ms
0.025, # 25ms
0.030, # 30ms
0.035, # 35ms
0.040, # 40ms
0.045, # 45ms
0.050, # 50ms
0.060, # 60ms
0.075, # 75ms
0.100, # 100ms
0.150, # 150ms
0.200, # 200ms
0.500, # 500ms
1.0, # 1s
2.0, # 2s
5.0, # 5s
10.0, # 10s
)
HYBRID_60_120MS_BUCKETS = (
0.010, # 10ms
0.030, # 30ms
0.050, # 50ms
0.060, # 60ms
0.065, # 65ms
0.070, # 70ms
0.075, # 75ms
0.080, # 80ms
0.085, # 85ms
0.090, # 90ms
0.095, # 95ms
0.100, # 100ms
0.110, # 110ms
0.120, # 120ms
0.150, # 150ms
0.200, # 200ms
0.300, # 200ms
0.400, # 200ms
0.500, # 500ms
1.0, # 1s
2.0, # 2s
5.0, # 5s
10.0, # 10s
)
HYBRID_300MS_1600MS_BUCKETS = (
0.010, # 10ms
0.050, # 50ms
0.100, # 100ms
0.150, # 150ms
0.200, # 200ms
0.250, # 250ms
0.300, # 300ms
0.350, # 350ms
0.400, # 400ms
0.450, # 450ms
0.500, # 500ms
0.550, # 550ms
0.600, # 600ms
0.650, # 650ms
0.700, # 700ms
0.750, # 750ms
0.800, # 800ms
0.850, # 850ms
0.900, # 900ms
0.950, # 950ms
1.000, # 1s
1.100, # 1.1s
1.200, # 1.2s
1.300, # 1.3s
1.400, # 1.4s
1.500, # 1.5s
1.600, # 1.6s
2.000, # 2s
3.000, # 3s
)
HYBRID_1_30S_BUCKETS = (
1.0, # 1s
1.5, # 1.5s
2.0, # 2s
2.5, # 2.5s
3.0, # 3s
3.5, # 3.5s
4.0, # 4s
4.5, # 4.5s
5.0, # 5s
5.5, # 5.5s
6.0, # 6s
6.5, # 6.5s
7.0, # 7s
7.5, # 7.5s
8.0, # 8s
8.5, # 8.5s
9.0, # 9s
9.5, # 9.5s
10.0, # 10s
11.0, # 11s
12.0, # 12s
13.0, # 13s
15.0, # 15s
16.0, # 16s
17.0, # 17s
18.0, # 18s
19.0, # 19s
20.0, # 20s
21.0, # 21s
22.0, # 22s
23.0, # 23s
25.0, # 25s
30.0, # 30s
)
HYBRID_30_900S_BUCKETS = (
1.0, # 1s
5.0, # 5s
10.0, # 10s
20.0, # 20s
30.0, # 30s
35.0, # 35s
40.0, # 40s
50.0, # 50s
60.0, # 1min
70.0, # 1min10s
80.0, # 1min20s
90.0, # 1min30s
100.0, # 1min40s
110.0, # 1min50s
120.0, # 2min
130.0, # 2min10s
140.0, # 2min20s
150.0, # 2min30s
180.0, # 3min
240.0, # 4min
300.0, # 5min
600.0, # 10min
900.0, # 15min
)
METRICS_INFO = { METRICS_INFO = {
"lightx2v_worker_request_count": MetricsConfig( "lightx2v_worker_request_count": MetricsConfig(
name="lightx2v_worker_request_count", name="lightx2v_worker_request_count",
...@@ -91,42 +238,55 @@ METRICS_INFO = { ...@@ -91,42 +238,55 @@ METRICS_INFO = {
desc="Duration of run per step Dit (s)", desc="Duration of run per step Dit (s)",
type_="histogram", type_="histogram",
labels=["step_no", "total_steps"], labels=["step_no", "total_steps"],
buckets=HYBRID_30_900S_BUCKETS,
), ),
"lightx2v_run_text_encode_duration": MetricsConfig( "lightx2v_run_text_encode_duration": MetricsConfig(
name="lightx2v_run_text_encode_duration", name="lightx2v_run_text_encode_duration",
desc="Duration of run text encode (s)", desc="Duration of run text encode (s)",
type_="histogram", type_="histogram",
labels=["model_cls"], labels=["model_cls"],
buckets=HYBRID_1_30S_BUCKETS,
), ),
"lightx2v_run_img_encode_duration": MetricsConfig( "lightx2v_run_img_encode_duration": MetricsConfig(
name="lightx2v_run_img_encode_duration", name="lightx2v_run_img_encode_duration",
desc="Duration of run img encode (s)", desc="Duration of run img encode (s)",
type_="histogram", type_="histogram",
labels=["model_cls"], labels=["model_cls"],
buckets=HYBRID_10_50MS_BUCKETS,
), ),
"lightx2v_run_vae_encode_duration": MetricsConfig( "lightx2v_run_vae_encode_duration": MetricsConfig(
name="lightx2v_run_vae_encode_duration", name="lightx2v_run_vae_encode_duration",
desc="Duration of run vae encode (s)", desc="Duration of run vae encode (s)",
type_="histogram", type_="histogram",
labels=["model_cls"], labels=["model_cls"],
buckets=HYBRID_60_120MS_BUCKETS,
), ),
"lightx2v_run_vae_decode_duration": MetricsConfig( "lightx2v_run_vae_decode_duration": MetricsConfig(
name="lightx2v_run_vae_decode_duration", name="lightx2v_run_vae_decode_duration",
desc="Duration of run vae decode (s)", desc="Duration of run vae decode (s)",
type_="histogram", type_="histogram",
labels=["model_cls"], labels=["model_cls"],
buckets=HYBRID_1_30S_BUCKETS,
), ),
"lightx2v_run_init_run_segment_duration": MetricsConfig( "lightx2v_run_init_run_segment_duration": MetricsConfig(
name="lightx2v_run_init_run_segment_duration", name="lightx2v_run_init_run_segment_duration",
desc="Duration of run init_run_segment (s)", desc="Duration of run init_run_segment (s)",
type_="histogram", type_="histogram",
labels=["model_cls"], labels=["model_cls"],
buckets=HYBRID_1_30S_BUCKETS,
), ),
"lightx2v_run_end_run_segment_duration": MetricsConfig( "lightx2v_run_end_run_segment_duration": MetricsConfig(
name="lightx2v_run_end_run_segment_duration", name="lightx2v_run_end_run_segment_duration",
desc="Duration of run end_run_segment (s)", desc="Duration of run end_run_segment (s)",
type_="histogram", type_="histogram",
labels=["model_cls"], labels=["model_cls"],
buckets=HYBRID_300MS_1600MS_BUCKETS,
),
"lightx2v_run_segments_end2end_duration": MetricsConfig(
name="lightx2v_run_segments_end2end_duration",
desc="Duration of run segments end2end (s)",
type_="histogram",
labels=["model_cls"],
), ),
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment