Unverified Commit 0aaab832 authored by yihuiwen's avatar yihuiwen Committed by GitHub
Browse files

add vae_encoder_pre_latent duration metrics (#381)


Co-authored-by: default avataryihuiwen <yihuiwen@sensetime.com>
parent 85f29d72
...@@ -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_encoder_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}
......
...@@ -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_encoder_image_duration,
metrics_labels=["WanAnimateRunner"], metrics_labels=["WanAnimateRunner"],
) )
def run_vae_encoder( def run_vae_encoder(
......
...@@ -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_encoder_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))
......
...@@ -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_encoder_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_encoder_image_duration,
metrics_labels=["Wan22DenseRunner"], metrics_labels=["Wan22DenseRunner"],
) )
def run_vae_encoder(self, img): def run_vae_encoder(self, img):
......
...@@ -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_encoder_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):
......
...@@ -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_encoder_image_duration": MetricsConfig(
name="lightx2v_run_vae_encode_duration", name="lightx2v_run_vae_encoder_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)",
......
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