[diffusion] chore: improve the output_path config and enable the server to return inference duration (#16965)
Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user