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
0aaab832
Unverified
Commit
0aaab832
authored
Oct 20, 2025
by
yihuiwen
Committed by
GitHub
Oct 20, 2025
Browse files
add vae_encoder_pre_latent duration metrics (#381)
Co-authored-by:
yihuiwen
<
yihuiwen@sensetime.com
>
parent
85f29d72
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
10 deletions
+22
-10
lightx2v/models/runners/qwen_image/qwen_image_runner.py
lightx2v/models/runners/qwen_image/qwen_image_runner.py
+1
-1
lightx2v/models/runners/wan/wan_animate_runner.py
lightx2v/models/runners/wan/wan_animate_runner.py
+1
-1
lightx2v/models/runners/wan/wan_audio_runner.py
lightx2v/models/runners/wan/wan_audio_runner.py
+7
-2
lightx2v/models/runners/wan/wan_runner.py
lightx2v/models/runners/wan/wan_runner.py
+2
-2
lightx2v/models/runners/wan/wan_vace_runner.py
lightx2v/models/runners/wan/wan_vace_runner.py
+1
-1
lightx2v/server/metrics/metrics.py
lightx2v/server/metrics/metrics.py
+10
-3
No files found.
lightx2v/models/runners/qwen_image/qwen_image_runner.py
View file @
0aaab832
...
@@ -125,7 +125,7 @@ class QwenImageRunner(DefaultRunner):
...
@@ -125,7 +125,7 @@ class QwenImageRunner(DefaultRunner):
text_encoder_output
[
"image_info"
]
=
image_info
text_encoder_output
[
"image_info"
]
=
image_info
return
text_encoder_output
return
text_encoder_output
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode_duration
,
metrics_labels
=
[
"QwenImageRunner"
])
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode
r_image
_duration
,
metrics_labels
=
[
"QwenImageRunner"
])
def
run_vae_encoder
(
self
,
image
):
def
run_vae_encoder
(
self
,
image
):
image_latents
=
self
.
vae
.
encode_vae_image
(
image
)
image_latents
=
self
.
vae
.
encode_vae_image
(
image
)
return
{
"image_latents"
:
image_latents
}
return
{
"image_latents"
:
image_latents
}
...
...
lightx2v/models/runners/wan/wan_animate_runner.py
View file @
0aaab832
...
@@ -154,7 +154,7 @@ class WanAnimateRunner(WanRunner):
...
@@ -154,7 +154,7 @@ class WanAnimateRunner(WanRunner):
@
ProfilingContext4DebugL1
(
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode_duration
,
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode
r_image
_duration
,
metrics_labels
=
[
"WanAnimateRunner"
],
metrics_labels
=
[
"WanAnimateRunner"
],
)
)
def
run_vae_encoder
(
def
run_vae_encoder
(
...
...
lightx2v/models/runners/wan/wan_audio_runner.py
View file @
0aaab832
...
@@ -470,7 +470,7 @@ class WanAudioRunner(WanRunner): # type:ignore
...
@@ -470,7 +470,7 @@ class WanAudioRunner(WanRunner): # type:ignore
@
ProfilingContext4DebugL1
(
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode_duration
,
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode
r_image
_duration
,
metrics_labels
=
[
"WanAudioRunner"
],
metrics_labels
=
[
"WanAudioRunner"
],
)
)
def
run_vae_encoder
(
self
,
img
):
def
run_vae_encoder
(
self
,
img
):
...
@@ -533,7 +533,12 @@ class WanAudioRunner(WanRunner): # type:ignore
...
@@ -533,7 +533,12 @@ class WanAudioRunner(WanRunner): # type:ignore
self
.
vae_encoder
=
self
.
load_vae_encoder
()
self
.
vae_encoder
=
self
.
load_vae_encoder
()
_
,
nframe
,
height
,
width
=
self
.
model
.
scheduler
.
latents
.
shape
_
,
nframe
,
height
,
width
=
self
.
model
.
scheduler
.
latents
.
shape
with
ProfilingContext4DebugL1
(
"vae_encoder in init run segment"
):
with
ProfilingContext4DebugL1
(
"vae_encoder in init run segment"
,
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encoder_pre_latent_duration
,
metrics_labels
=
[
"WanAudioRunner"
],
):
if
self
.
config
[
"model_cls"
]
==
"wan2.2_audio"
:
if
self
.
config
[
"model_cls"
]
==
"wan2.2_audio"
:
if
prev_video
is
not
None
:
if
prev_video
is
not
None
:
prev_latents
=
self
.
vae_encoder
.
encode
(
prev_frames
.
to
(
dtype
))
prev_latents
=
self
.
vae_encoder
.
encode
(
prev_frames
.
to
(
dtype
))
...
...
lightx2v/models/runners/wan/wan_runner.py
View file @
0aaab832
...
@@ -273,7 +273,7 @@ class WanRunner(DefaultRunner):
...
@@ -273,7 +273,7 @@ class WanRunner(DefaultRunner):
@
ProfilingContext4DebugL1
(
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode_duration
,
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode
r_image
_duration
,
metrics_labels
=
[
"WanRunner"
],
metrics_labels
=
[
"WanRunner"
],
)
)
def
run_vae_encoder
(
self
,
first_frame
,
last_frame
=
None
):
def
run_vae_encoder
(
self
,
first_frame
,
last_frame
=
None
):
...
@@ -509,7 +509,7 @@ class Wan22DenseRunner(WanRunner):
...
@@ -509,7 +509,7 @@ class Wan22DenseRunner(WanRunner):
@
ProfilingContext4DebugL1
(
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode_duration
,
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode
r_image
_duration
,
metrics_labels
=
[
"Wan22DenseRunner"
],
metrics_labels
=
[
"Wan22DenseRunner"
],
)
)
def
run_vae_encoder
(
self
,
img
):
def
run_vae_encoder
(
self
,
img
):
...
...
lightx2v/models/runners/wan/wan_vace_runner.py
View file @
0aaab832
...
@@ -92,7 +92,7 @@ class WanVaceRunner(WanRunner):
...
@@ -92,7 +92,7 @@ class WanVaceRunner(WanRunner):
@
ProfilingContext4DebugL1
(
@
ProfilingContext4DebugL1
(
"Run VAE Encoder"
,
"Run VAE Encoder"
,
recorder_mode
=
GET_RECORDER_MODE
(),
recorder_mode
=
GET_RECORDER_MODE
(),
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode_duration
,
metrics_func
=
monitor_cli
.
lightx2v_run_vae_encode
r_image
_duration
,
metrics_labels
=
[
"WanVaceRunner"
],
metrics_labels
=
[
"WanVaceRunner"
],
)
)
def
run_vae_encoder
(
self
,
frames
,
ref_images
,
masks
):
def
run_vae_encoder
(
self
,
frames
,
ref_images
,
masks
):
...
...
lightx2v/server/metrics/metrics.py
View file @
0aaab832
...
@@ -254,13 +254,20 @@ METRICS_INFO = {
...
@@ -254,13 +254,20 @@ METRICS_INFO = {
labels
=
[
"model_cls"
],
labels
=
[
"model_cls"
],
buckets
=
HYBRID_10_50MS_BUCKETS
,
buckets
=
HYBRID_10_50MS_BUCKETS
,
),
),
"lightx2v_run_vae_encode_duration"
:
MetricsConfig
(
"lightx2v_run_vae_encode
r_image
_duration"
:
MetricsConfig
(
name
=
"lightx2v_run_vae_encode_duration"
,
name
=
"lightx2v_run_vae_encode
r_image
_duration"
,
desc
=
"Duration of run vae encode (s)"
,
desc
=
"Duration of run vae encode
for image
(s)"
,
type_
=
"histogram"
,
type_
=
"histogram"
,
labels
=
[
"model_cls"
],
labels
=
[
"model_cls"
],
buckets
=
HYBRID_60_120MS_BUCKETS
,
buckets
=
HYBRID_60_120MS_BUCKETS
,
),
),
"lightx2v_run_vae_encoder_pre_latent_duration"
:
MetricsConfig
(
name
=
"lightx2v_run_vae_encoder_pre_latent_duration"
,
desc
=
"Duration of run vae encode for pre latents (s)"
,
type_
=
"histogram"
,
labels
=
[
"model_cls"
],
buckets
=
HYBRID_1_30S_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)"
,
...
...
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