Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xuwx1
LightX2V
Commits
77f3d55e
Unverified
Commit
77f3d55e
authored
Oct 11, 2025
by
yihuiwen
Committed by
GitHub
Oct 11, 2025
Browse files
add run init_run_segment & run end_run_segment latency metrics (#359)
Co-authored-by:
yihuiwen
<
yihuiwen@sensetime.com
>
parent
085c969c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
7 deletions
+36
-7
Dockerfile_deploy
Dockerfile_deploy
+1
-1
lightx2v/models/runners/default_runner.py
lightx2v/models/runners/default_runner.py
+1
-1
lightx2v/models/runners/wan/wan_animate_runner.py
lightx2v/models/runners/wan/wan_animate_runner.py
+6
-0
lightx2v/models/runners/wan/wan_audio_runner.py
lightx2v/models/runners/wan/wan_audio_runner.py
+12
-2
lightx2v/server/metrics/metrics.py
lightx2v/server/metrics/metrics.py
+14
-1
lightx2v/utils/profiler.py
lightx2v/utils/profiler.py
+2
-2
No files found.
Dockerfile_deploy
View file @
77f3d55e
...
...
@@ -5,7 +5,7 @@ RUN cd /opt/lightx2v/deploy/server/frontend \
&& npm install \
&& npm run build
FROM lightx2v:25092201-cu128 AS base
FROM
lightx2v/
lightx2v:25092201-cu128 AS base
RUN mkdir /workspace/LightX2V
WORKDIR /workspace/LightX2V
...
...
lightx2v/models/runners/default_runner.py
View file @
77f3d55e
...
...
@@ -259,7 +259,7 @@ class DefaultRunner(BaseRunner):
with
ProfilingContext4DebugL1
(
f
"segment end2end
{
segment_idx
+
1
}
/
{
self
.
video_segment_num
}
"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_p
r
e_step_dit_duration
,
metrics_func
=
monitor_cli
.
lightx2v_run_pe
r
_step_dit_duration
,
metrics_labels
=
[
segment_idx
+
1
,
self
.
video_segment_num
],
):
self
.
check_stop
()
...
...
lightx2v/models/runners/wan/wan_animate_runner.py
View file @
77f3d55e
...
...
@@ -292,6 +292,12 @@ class WanAnimateRunner(WanRunner):
gc
.
collect
()
return
images
@
ProfilingContext4DebugL1
(
"Init run segment"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_init_run_segment_duration
,
metrics_labels
=
[
"WanAnimateRunner"
],
)
def
init_run_segment
(
self
,
segment_idx
):
start
=
segment_idx
*
self
.
move_frames
end
=
start
+
self
.
config
[
"target_video_length"
]
...
...
lightx2v/models/runners/wan/wan_audio_runner.py
View file @
77f3d55e
...
...
@@ -587,7 +587,12 @@ class WanAudioRunner(WanRunner): # type:ignore
self
.
gen_video_final
=
None
self
.
cut_audio_final
=
None
@
ProfilingContext4DebugL1
(
"Init run segment"
)
@
ProfilingContext4DebugL1
(
"Init run segment"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_init_run_segment_duration
,
metrics_labels
=
[
"WanAudioRunner"
],
)
def
init_run_segment
(
self
,
segment_idx
,
audio_array
=
None
):
self
.
segment_idx
=
segment_idx
if
audio_array
is
not
None
:
...
...
@@ -618,7 +623,12 @@ class WanAudioRunner(WanRunner): # type:ignore
if
segment_idx
>
0
:
self
.
model
.
scheduler
.
reset
(
self
.
input_info
.
seed
,
self
.
input_info
.
latent_shape
,
self
.
inputs
[
"previmg_encoder_output"
])
@
ProfilingContext4DebugL1
(
"End run segment"
)
@
ProfilingContext4DebugL1
(
"End run segment"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_end_run_segment_duration
,
metrics_labels
=
[
"WanAudioRunner"
],
)
def
end_run_segment
(
self
,
segment_idx
):
self
.
gen_video
=
torch
.
clamp
(
self
.
gen_video
,
-
1
,
1
).
to
(
torch
.
float
)
useful_length
=
self
.
segment
.
end_frame
-
self
.
segment
.
start_frame
...
...
lightx2v/server/metrics/metrics.py
View file @
77f3d55e
...
...
@@ -48,6 +48,7 @@ METRICS_INFO = {
name
=
"lightx2v_worker_request_duration"
,
desc
=
"Duration of the request (s)"
,
type_
=
"histogram"
,
labels
=
[
"model_cls"
],
),
"lightx2v_input_audio_len"
:
MetricsConfig
(
name
=
"lightx2v_input_audio_len"
,
...
...
@@ -86,7 +87,7 @@ METRICS_INFO = {
type_
=
"histogram"
,
),
"lightx2v_run_per_step_dit_duration"
:
MetricsConfig
(
name
=
"lightx2v_run_p
r
e_step_dit_duration"
,
name
=
"lightx2v_run_pe
r
_step_dit_duration"
,
desc
=
"Duration of run per step Dit (s)"
,
type_
=
"histogram"
,
labels
=
[
"step_no"
,
"total_steps"
],
...
...
@@ -115,6 +116,18 @@ METRICS_INFO = {
type_
=
"histogram"
,
labels
=
[
"model_cls"
],
),
"lightx2v_run_init_run_segment_duration"
:
MetricsConfig
(
name
=
"lightx2v_run_init_run_segment_duration"
,
desc
=
"Duration of run init_run_segment (s)"
,
type_
=
"histogram"
,
labels
=
[
"model_cls"
],
),
"lightx2v_run_end_run_segment_duration"
:
MetricsConfig
(
name
=
"lightx2v_run_end_run_segment_duration"
,
desc
=
"Duration of run end_run_segment (s)"
,
type_
=
"histogram"
,
labels
=
[
"model_cls"
],
),
}
...
...
lightx2v/utils/profiler.py
View file @
77f3d55e
...
...
@@ -36,7 +36,7 @@ class _ProfilingContext:
elapsed
=
time
.
perf_counter
()
-
self
.
start_time
if
self
.
enable_recorder
and
self
.
metrics_func
:
if
self
.
metrics_labels
:
self
.
metrics_func
.
labels
(
self
.
metrics_labels
).
observe
(
elapsed
)
self
.
metrics_func
.
labels
(
*
self
.
metrics_labels
).
observe
(
elapsed
)
else
:
self
.
metrics_func
.
observe
(
elapsed
)
if
self
.
enable_logger
:
...
...
@@ -53,7 +53,7 @@ class _ProfilingContext:
elapsed
=
time
.
perf_counter
()
-
self
.
start_time
if
self
.
enable_recorder
and
self
.
metrics_func
:
if
self
.
metrics_labels
:
self
.
metrics_func
.
labels
(
self
.
metrics_labels
).
observe
(
elapsed
)
self
.
metrics_func
.
labels
(
*
self
.
metrics_labels
).
observe
(
elapsed
)
else
:
self
.
metrics_func
.
observe
(
elapsed
)
if
self
.
enable_logger
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment