[Bugfix] Return diffusion metrics for image-edit endpoint (#5999)
Signed-off-by: Kristoffer <kristoffer.torp@amd.com> Signed-off-by: kTorp <kristorp@amd.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
273ffce130
commit
718d9a4cd7
3 files changed
+128
-5
No files matched your search
@@ -2377,7 +2377,7 @@ async def edit_images(
|
||||
status_code=generation_result.error.code if generation_result.error else 400,
|
||||
detail=generation_result.message,
|
||||
)
|
||||
images, _, _, cot_output = generation_result
|
||||
images, stage_durations, peak_memory_mb, cot_output = generation_result
|
||||
else:
|
||||
# Single-stage diffusion: use the direct path.
|
||||
result = await _generate_with_async_omni(
|
||||
@@ -2388,6 +2388,8 @@ async def edit_images(
|
||||
request_id=request_id,
|
||||
)
|
||||
images = _extract_images_from_result(result)
|
||||
stage_durations = getattr(result, "stage_durations", None)
|
||||
peak_memory_mb = getattr(result, "peak_memory_mb", None)
|
||||
|
||||
logger.debug(f"Successfully generated {len(images)} image(s)")
|
||||
|
||||
@@ -2408,6 +2410,10 @@ async def edit_images(
|
||||
output_format=output_format,
|
||||
size=size_str,
|
||||
cot_output=cot_output,
|
||||
metrics={
|
||||
"stage_durations": stage_durations or None,
|
||||
"peak_memory_mb": float(peak_memory_mb) if peak_memory_mb else None,
|
||||
},
|
||||
)
|
||||
|
||||
except (EngineGenerateError, EngineDeadError) as exc:
|
||||
|
||||
Reference in new issue
Block a user