diff --git a/python/sglang/multimodal_gen/configs/sample/sampling_params.py b/python/sglang/multimodal_gen/configs/sample/sampling_params.py index 44350691b..14dc94b07 100644 --- a/python/sglang/multimodal_gen/configs/sample/sampling_params.py +++ b/python/sglang/multimodal_gen/configs/sample/sampling_params.py @@ -318,6 +318,12 @@ class SamplingParams: self.data_type = server_args.pipeline_config.task_type.data_type() + if server_args.output_path is not None: + self.output_path = server_args.output_path + logger.debug( + f"Overriding output_path with server configuration: {self.output_path}" + ) + # Process negative prompt if self.negative_prompt is not None and not self.negative_prompt.isspace(): # avoid stripping default negative prompt: ' ' for qwen-image @@ -533,12 +539,6 @@ class SamplingParams: default=SamplingParams.prompt_path, help="Path to a text file containing the prompt", ) - parser.add_argument( - "--output-path", - type=str, - default=SamplingParams.output_path, - help="Path to save the generated image/video", - ) parser.add_argument( "--output-file-name", type=str, diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/openai/protocol.py b/python/sglang/multimodal_gen/runtime/entrypoints/openai/protocol.py index e56861a33..eb85681ea 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/openai/protocol.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/openai/protocol.py @@ -17,6 +17,7 @@ class ImageResponse(BaseModel): created: int = Field(default_factory=lambda: int(time.time())) data: List[ImageResponseData] peak_memory_mb: Optional[float] = None + inference_time_s: Optional[float] = None class ImageGenerationsRequest(BaseModel): @@ -60,6 +61,7 @@ class VideoResponse(BaseModel): error: Optional[Dict[str, Any]] = None file_path: Optional[str] = None peak_memory_mb: Optional[float] = None + inference_time_s: Optional[float] = None class VideoGenerationsRequest(BaseModel): diff --git a/python/sglang/multimodal_gen/runtime/entrypoints/openai/utils.py b/python/sglang/multimodal_gen/runtime/entrypoints/openai/utils.py index 92445ad8b..b62b468b7 100644 --- a/python/sglang/multimodal_gen/runtime/entrypoints/openai/utils.py +++ b/python/sglang/multimodal_gen/runtime/entrypoints/openai/utils.py @@ -288,6 +288,9 @@ def add_common_data_to_response( if result.peak_memory_mb and result.peak_memory_mb > 0: response["peak_memory_mb"] = result.peak_memory_mb + if result.timings and result.timings.total_duration_s > 0: + response["inference_time_s"] = result.timings.total_duration_s + response["id"] = request_id return response diff --git a/python/sglang/multimodal_gen/runtime/server_args.py b/python/sglang/multimodal_gen/runtime/server_args.py index 014e15adb..df2fe812a 100644 --- a/python/sglang/multimodal_gen/runtime/server_args.py +++ b/python/sglang/multimodal_gen/runtime/server_args.py @@ -328,6 +328,8 @@ class ServerArgs: scheduler_port: int = 5555 + output_path: str | None = None + # Prompt text file for batch processing prompt_file_path: str | None = None @@ -682,6 +684,12 @@ class ServerArgs: default=ServerArgs.webui_port, help="Whether to use webui for better display", ) + parser.add_argument( + "--output-path", + type=str, + default=ServerArgs.output_path, + help="Directory path to save generated images/videos", + ) # LoRA parser.add_argument(