[Refactor]Rename diffusion benchmark backend to endpoint (#3137)
Signed-off-by: bjf-frz <frz123db@gmail.com> Signed-off-by: bjfwhite <baijingfan1@huawei.com> Co-authored-by: bjfwhite <baijingfan1@huawei.com>
This commit is contained in:
1 parent
2c6b1bb0c0
commit
1fa734419e
19 files changed
+352
-87
No files matched your search
@@ -18,6 +18,8 @@ from openpyxl import Workbook
|
||||
from openpyxl.styles import PatternFill
|
||||
from openpyxl.utils import get_column_letter
|
||||
|
||||
from benchmarks.diffusion.backends import normalize_endpoint
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
GREY_BLOCK_FILL = PatternFill(start_color="D3D3D3", fill_type="solid")
|
||||
@@ -60,7 +62,7 @@ DIFFUSION_SUMMARY_COLUMNS: tuple[str, ...] = (
|
||||
"date",
|
||||
"test_name",
|
||||
"model",
|
||||
"backend",
|
||||
"endpoint",
|
||||
"dataset",
|
||||
"task",
|
||||
"completed_requests",
|
||||
@@ -528,6 +530,12 @@ def _process_diffusion_record(record: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Normalize a diffusion record by merging `result` and flattening stage metrics."""
|
||||
flat = record.copy()
|
||||
flat.update(flat.pop("result", {}))
|
||||
if flat.get("endpoint"):
|
||||
flat["endpoint"] = normalize_endpoint(flat["endpoint"])
|
||||
elif flat.get("backend"):
|
||||
flat["endpoint"] = normalize_endpoint(flat["backend"])
|
||||
flat.pop("backend", None)
|
||||
flat.pop("API Backend", None)
|
||||
flat = _flatten_stage_durations(flat)
|
||||
flat.pop("benchmark_params", None)
|
||||
flat.pop("server_params", None)
|
||||
@@ -752,6 +760,7 @@ _OMNI_SUMMARY_WIDTHS = {
|
||||
_DIFFUSION_SUMMARY_WIDTHS = {
|
||||
"test_name": 30,
|
||||
"model": 15,
|
||||
"endpoint": 24,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ from collections.abc import Iterable, Sequence
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
|
||||
from benchmarks.diffusion.backends import normalize_endpoint
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
_RESULT_JSON_PREFIX = "result_test_"
|
||||
@@ -222,6 +224,12 @@ def _iter_diffusion_json_records(input_dir: str) -> Iterable[dict[str, Any]]:
|
||||
result = flat.pop("result", None)
|
||||
if isinstance(result, dict):
|
||||
flat.update(result)
|
||||
if flat.get("endpoint"):
|
||||
flat["endpoint"] = normalize_endpoint(flat["endpoint"])
|
||||
elif flat.get("backend"):
|
||||
flat["endpoint"] = normalize_endpoint(flat["backend"])
|
||||
flat.pop("backend", None)
|
||||
flat.pop("API Backend", None)
|
||||
if "date" not in flat or not flat.get("date"):
|
||||
flat["date"] = filename_meta.get("date") or datetime.now(
|
||||
timezone.utc,
|
||||
@@ -1183,7 +1191,7 @@ function filterRows(rows, filters) {{
|
||||
) {{
|
||||
return false;
|
||||
}}
|
||||
if (filters.backend && String(row.backend || "") !== filters.backend) return false;
|
||||
if (filters.backend && String(row[filters.backendKey] || "") !== filters.backend) return false;
|
||||
if (
|
||||
filters.extraKey &&
|
||||
filters.extraValue &&
|
||||
@@ -1223,12 +1231,14 @@ function initSection(prefix, columns, data, numericCols, groups) {{
|
||||
|
||||
const modelKey = prefix === "diff" ? "model" : "model_id";
|
||||
const datasetKey = prefix === "diff" ? "dataset" : "dataset_name";
|
||||
const backendKey = prefix === "diff" ? "endpoint" : "backend";
|
||||
const backendLabel = prefix === "diff" ? "Endpoint" : "Backend";
|
||||
const extraKey = prefix === "diff" ? "" : "tokenizer_id";
|
||||
const metaKeys = prefix === "diff"
|
||||
? ["test_name"]
|
||||
: ["test_name", "max_concurrency", "num_prompts"];
|
||||
const configFields = prefix === "diff"
|
||||
? ["test_name", "model", "backend", "dataset"]
|
||||
? ["test_name", "model", "endpoint", "dataset"]
|
||||
: [
|
||||
"endpoint_type",
|
||||
"backend",
|
||||
@@ -1265,6 +1275,7 @@ function initSection(prefix, columns, data, numericCols, groups) {{
|
||||
extraKey,
|
||||
modelKey,
|
||||
datasetKey,
|
||||
backendKey,
|
||||
}};
|
||||
}}
|
||||
|
||||
@@ -1296,7 +1307,7 @@ function initSection(prefix, columns, data, numericCols, groups) {{
|
||||
}}
|
||||
fillSelect(
|
||||
backendList,
|
||||
uniqSorted(baseRows.map((row) => row.backend)),
|
||||
uniqSorted(baseRows.map((row) => row[backendKey])),
|
||||
backendInput.value,
|
||||
);
|
||||
if (extraList) {{
|
||||
@@ -1378,7 +1389,7 @@ function initSection(prefix, columns, data, numericCols, groups) {{
|
||||
}});
|
||||
|
||||
if (!backendInput.value.trim()) {{
|
||||
backendInput.value = firstValue(rows, "backend");
|
||||
backendInput.value = firstValue(rows, backendKey);
|
||||
}}
|
||||
rows = filterRows(data, {{
|
||||
...currentFilters(),
|
||||
@@ -1465,7 +1476,7 @@ function initSection(prefix, columns, data, numericCols, groups) {{
|
||||
`<div class="kv-value"><code>${{escapeHtml(filters.numPrompts || "All")}}</code></div></div>`
|
||||
)
|
||||
}}
|
||||
<div class="kv-row"><div class="kv-label">Backend</div><div class="kv-value"><code>${{escapeHtml(
|
||||
<div class="kv-row"><div class="kv-label">${{backendLabel}}</div><div class="kv-value"><code>${{escapeHtml(
|
||||
filters.backend || "All",
|
||||
)}}</code></div></div>
|
||||
${{
|
||||
@@ -1707,7 +1718,7 @@ window.addEventListener("load", () => {{
|
||||
'Diffusion</h2><div class="section-subtitle">Image generation '
|
||||
"benchmark history with throughput and latency trend views.</div>"
|
||||
'</div><div class="section-pills"><div class="pill"><strong>'
|
||||
"Grouping</strong> test_name + model + backend + dataset</div>"
|
||||
"Grouping</strong> test_name + model + endpoint + dataset</div>"
|
||||
'<div class="pill"><strong>Snapshots</strong> single-point series '
|
||||
"stay readable</div></div></div>"
|
||||
),
|
||||
@@ -1736,7 +1747,7 @@ window.addEventListener("load", () => {{
|
||||
" </div>",
|
||||
' <div class="toolbar-row secondary">',
|
||||
(
|
||||
' <div class="filter-field compact"><label>backend</label>'
|
||||
' <div class="filter-field compact"><label>endpoint</label>'
|
||||
'<select class="filter-select" id="diff-backend"></select></div>'
|
||||
),
|
||||
(
|
||||
@@ -1803,7 +1814,7 @@ def generate_html_report(input_dir: str, diffusion_input_dir: str, output_file:
|
||||
"date",
|
||||
"test_name",
|
||||
"model",
|
||||
"backend",
|
||||
"endpoint",
|
||||
"dataset",
|
||||
"task",
|
||||
"duration",
|
||||
|
||||
Reference in new issue
Block a user