[Performance] diffusion timing (#1757)
Signed-off-by: dengyunyang <584797741@qq.com> Signed-off-by: bjf-frz <frz123db@gmail.com> Signed-off-by: Didan Deng <33117903+wtomin@users.noreply.github.com> Co-authored-by: bjf-frz <frz123db@gmail.com> Co-authored-by: Didan Deng <33117903+wtomin@users.noreply.github.com>
This commit is contained in:
43 files changed
+496
-38
No files matched your search
@@ -351,6 +351,13 @@ class OmniServeCommand(CLISubcommand):
|
||||
default=None,
|
||||
help="Maximum length for TTS voice style instructions (overrides stage config, default: 500).",
|
||||
)
|
||||
|
||||
# Enable diffusion pipeline profiling
|
||||
omni_config_group.add_argument(
|
||||
"--enable-diffusion-pipeline-profiler",
|
||||
action="store_true",
|
||||
help="Enable diffusion pipeline profiler to display stage durations.",
|
||||
)
|
||||
return serve_parser
|
||||
|
||||
|
||||
|
||||
@@ -238,6 +238,7 @@ class OmniBase:
|
||||
) -> OmniRequestOutput | None:
|
||||
req_id = result.get("request_id")
|
||||
engine_outputs = result.get("engine_outputs")
|
||||
stage_durations = getattr(result["engine_outputs"], "stage_durations", {})
|
||||
finished = engine_outputs.finished
|
||||
|
||||
submit_ts = result.get("stage_submit_ts")
|
||||
@@ -271,6 +272,7 @@ class OmniBase:
|
||||
final_output_type=stage_meta["final_output_type"],
|
||||
request_output=engine_outputs,
|
||||
images=images,
|
||||
stage_durations=stage_durations,
|
||||
)
|
||||
|
||||
def shutdown(self) -> None:
|
||||
|
||||
@@ -1906,6 +1906,9 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
choices: list[ChatCompletionResponseChoice] = []
|
||||
final_res = omni_outputs.request_output
|
||||
|
||||
# Handle profiling data
|
||||
stage_durations = omni_outputs.stage_durations
|
||||
|
||||
# Handle different image output formats
|
||||
images = []
|
||||
|
||||
@@ -1959,6 +1962,7 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
"image_url": {
|
||||
"url": f"data:image/png;base64,{img_base64}",
|
||||
},
|
||||
"stage_durations": stage_durations,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -2160,6 +2164,7 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
# Extract images from result
|
||||
# Handle nested OmniRequestOutput structure where images might be in request_output
|
||||
images = getattr(result.request_output, "images", [])
|
||||
stage_durations = result.stage_durations
|
||||
|
||||
# Convert images to base64 content
|
||||
image_contents: list[dict[str, Any]] = []
|
||||
@@ -2174,6 +2179,7 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
|
||||
"image_url": {
|
||||
"url": f"data:image/png;base64,{img_base64}",
|
||||
},
|
||||
"stage_durations": stage_durations,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user