Update script.js
Browse files
script.js
CHANGED
|
@@ -296,10 +296,14 @@
|
|
| 296 |
.map((m, i) => {
|
| 297 |
const rank = i + 1;
|
| 298 |
const avg = avgScore(m, benches);
|
| 299 |
-
|
|
|
|
| 300 |
<div class="m-card-top">
|
| 301 |
-
<span
|
| 302 |
-
|
|
|
|
|
|
|
|
|
|
| 303 |
</div>
|
| 304 |
<div class="m-card-meta">${orgTag(m.org)}<span class="params">${fmtParams(m.params_b)}</span></div>
|
| 305 |
<div class="m-scores">
|
|
@@ -308,9 +312,18 @@
|
|
| 308 |
const v = runScore(m, b.id);
|
| 309 |
return `<div class="m-score"><div class="k">${esc(shortLabel(b))}</div><div class="v">${fmtScore(v) ?? "β"}</div></div>`;
|
| 310 |
}).join("")}
|
| 311 |
-
</div>
|
|
|
|
|
|
|
| 312 |
})
|
| 313 |
.join("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
}
|
| 315 |
|
| 316 |
// ---------------------------------------------------------------------
|
|
@@ -326,6 +339,25 @@
|
|
| 326 |
return run && numeric(run.score) ? run.score : null;
|
| 327 |
}
|
| 328 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
function renderT2i() {
|
| 330 |
const section = $("#t2i-section");
|
| 331 |
const benches = t2iBenches();
|
|
@@ -341,39 +373,50 @@
|
|
| 341 |
|
| 342 |
const head = $("#t2i-head");
|
| 343 |
head.innerHTML = `<tr>
|
| 344 |
-
<th>#</th><th>Model</th><th>Org</th><th class="num">Params</th>
|
|
|
|
|
|
|
| 345 |
${benches.map((b) => `<th class="num" title="${esc(b.description || "")}">${esc(b.label)}${b.lower_is_better ? " β" : ""}</th>`).join("")}
|
| 346 |
<th>Released</th></tr>`;
|
| 347 |
|
| 348 |
if (!models.length) {
|
| 349 |
$("#t2i-body").innerHTML = "";
|
|
|
|
| 350 |
$("#t2i-empty").hidden = false;
|
| 351 |
return;
|
| 352 |
}
|
| 353 |
$("#t2i-empty").hidden = true;
|
| 354 |
|
| 355 |
-
//
|
| 356 |
-
const primary = benches[0];
|
| 357 |
-
const sorted = models.slice().sort((a, b) => {
|
| 358 |
-
const va = t2iRunValue(a, primary.id), vb = t2iRunValue(b, primary.id);
|
| 359 |
-
const aa = va === null ? Infinity : va, bb = vb === null ? Infinity : vb;
|
| 360 |
-
return primary.lower_is_better ? aa - bb : bb - aa;
|
| 361 |
-
});
|
| 362 |
-
|
| 363 |
const ranges = benches.map((b) => {
|
| 364 |
-
const vals =
|
| 365 |
const best = vals.length ? (b.lower_is_better ? Math.min(...vals) : Math.max(...vals)) : null;
|
| 366 |
return { min: Math.min(...vals), max: Math.max(...vals), best };
|
| 367 |
});
|
| 368 |
|
| 369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
const rank = i + 1;
|
| 371 |
-
const flagNote = m.runs && m.runs[
|
| 372 |
return `<tr${flagNote ? ` title="${esc(flagNote)}"` : ""}>
|
| 373 |
<td class="rank rank-${rank <= 3 ? rank : "n"}">#${rank}</td>
|
| 374 |
<td class="model-cell">${m.url ? `<a href="${esc(m.url)}" target="_blank" rel="noopener">${esc(m.name)}</a>` : esc(m.name)}${flagNote ? ' <span class="flag-dot" title="' + esc(flagNote) + '">β </span>' : ""}</td>
|
| 375 |
<td>${orgTag(m.org)}</td>
|
| 376 |
<td class="num">${fmtParams(m.params_b)}</td>
|
|
|
|
| 377 |
<td class="res">${esc(m.resolution || "β")}</td>
|
| 378 |
${benches.map((b, j) => {
|
| 379 |
const v = t2iRunValue(m, b.id);
|
|
@@ -384,6 +427,46 @@
|
|
| 384 |
<td class="res">${esc(m.release_date || "β")}</td>
|
| 385 |
</tr>`;
|
| 386 |
}).join("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
}
|
| 388 |
|
| 389 |
// ---------------------------------------------------------------------
|
|
|
|
| 296 |
.map((m, i) => {
|
| 297 |
const rank = i + 1;
|
| 298 |
const avg = avgScore(m, benches);
|
| 299 |
+
const open = state.expanded === m.id;
|
| 300 |
+
return `<div class="m-card${open ? " open" : ""}" data-id="${esc(m.id)}">
|
| 301 |
<div class="m-card-top">
|
| 302 |
+
<span style="display:flex;align-items:center;gap:9px;min-width:0;">
|
| 303 |
+
<span class="rank rank-${rank <= 3 ? rank : "n"}">#${rank}</span>
|
| 304 |
+
${m.url ? `<a href="${esc(m.url)}" target="_blank" rel="noopener" onclick="event.stopPropagation()">${esc(m.name)}</a>` : `<span>${esc(m.name)}</span>`}
|
| 305 |
+
</span>
|
| 306 |
+
<span class="expand-hint">βΆ</span>
|
| 307 |
</div>
|
| 308 |
<div class="m-card-meta">${orgTag(m.org)}<span class="params">${fmtParams(m.params_b)}</span></div>
|
| 309 |
<div class="m-scores">
|
|
|
|
| 312 |
const v = runScore(m, b.id);
|
| 313 |
return `<div class="m-score"><div class="k">${esc(shortLabel(b))}</div><div class="v">${fmtScore(v) ?? "β"}</div></div>`;
|
| 314 |
}).join("")}
|
| 315 |
+
</div>
|
| 316 |
+
${open ? `<div class="m-card-detail">${capabilityHtml(m, benches)}</div>` : ""}
|
| 317 |
+
</div>`;
|
| 318 |
})
|
| 319 |
.join("");
|
| 320 |
+
|
| 321 |
+
document.querySelectorAll("#model-cards .m-card").forEach((card) =>
|
| 322 |
+
card.addEventListener("click", () => {
|
| 323 |
+
state.expanded = state.expanded === card.dataset.id ? null : card.dataset.id;
|
| 324 |
+
render();
|
| 325 |
+
})
|
| 326 |
+
);
|
| 327 |
}
|
| 328 |
|
| 329 |
// ---------------------------------------------------------------------
|
|
|
|
| 339 |
return run && numeric(run.score) ? run.score : null;
|
| 340 |
}
|
| 341 |
|
| 342 |
+
// Composite score: each benchmark is min-max normalized across the visible
|
| 343 |
+
// set (inverted for lower_is_better), then averaged and scaled to 0-100.
|
| 344 |
+
// This mirrors the reference leaderboard's own "Overall Score" so ranking
|
| 345 |
+
// reflects both benchmarks together instead of just the first column.
|
| 346 |
+
function t2iComposite(model, benches, ranges) {
|
| 347 |
+
const parts = [];
|
| 348 |
+
benches.forEach((b, j) => {
|
| 349 |
+
const v = t2iRunValue(model, b.id);
|
| 350 |
+
if (!numeric(v)) return;
|
| 351 |
+
const { min, max } = ranges[j];
|
| 352 |
+
if (max === min) return;
|
| 353 |
+
let p = (v - min) / (max - min);
|
| 354 |
+
if (b.lower_is_better) p = 1 - p;
|
| 355 |
+
parts.push(p);
|
| 356 |
+
});
|
| 357 |
+
if (!parts.length) return null;
|
| 358 |
+
return (parts.reduce((s, v) => s + v, 0) / parts.length) * 100;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
function renderT2i() {
|
| 362 |
const section = $("#t2i-section");
|
| 363 |
const benches = t2iBenches();
|
|
|
|
| 373 |
|
| 374 |
const head = $("#t2i-head");
|
| 375 |
head.innerHTML = `<tr>
|
| 376 |
+
<th>#</th><th>Model</th><th>Org</th><th class="num">Params</th>
|
| 377 |
+
<th class="num" title="Normalized blend of all benchmarks below (0-100, higher is better)">Score</th>
|
| 378 |
+
<th>Res.</th>
|
| 379 |
${benches.map((b) => `<th class="num" title="${esc(b.description || "")}">${esc(b.label)}${b.lower_is_better ? " β" : ""}</th>`).join("")}
|
| 380 |
<th>Released</th></tr>`;
|
| 381 |
|
| 382 |
if (!models.length) {
|
| 383 |
$("#t2i-body").innerHTML = "";
|
| 384 |
+
$("#t2i-cards").innerHTML = "";
|
| 385 |
$("#t2i-empty").hidden = false;
|
| 386 |
return;
|
| 387 |
}
|
| 388 |
$("#t2i-empty").hidden = true;
|
| 389 |
|
| 390 |
+
// ranges computed once, over the full visible set, before sorting
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
const ranges = benches.map((b) => {
|
| 392 |
+
const vals = models.map((m) => t2iRunValue(m, b.id)).filter(numeric);
|
| 393 |
const best = vals.length ? (b.lower_is_better ? Math.min(...vals) : Math.max(...vals)) : null;
|
| 394 |
return { min: Math.min(...vals), max: Math.max(...vals), best };
|
| 395 |
});
|
| 396 |
|
| 397 |
+
const withScore = models.map((m) => ({ m, score: t2iComposite(m, benches, ranges) }));
|
| 398 |
+
// sort by composite score desc; ties broken by the first (primary) bench
|
| 399 |
+
withScore.sort((a, b) => {
|
| 400 |
+
const sa = a.score === null ? -1 : a.score, sb = b.score === null ? -1 : b.score;
|
| 401 |
+
if (sb !== sa) return sb - sa;
|
| 402 |
+
const primary = benches[0];
|
| 403 |
+
const va = t2iRunValue(a.m, primary.id), vb = t2iRunValue(b.m, primary.id);
|
| 404 |
+
const aa = va === null ? Infinity : va, bb = vb === null ? Infinity : vb;
|
| 405 |
+
return primary.lower_is_better ? aa - bb : bb - aa;
|
| 406 |
+
});
|
| 407 |
+
|
| 408 |
+
const scores = withScore.map((x) => x.score).filter(numeric);
|
| 409 |
+
const scoreBest = scores.length ? Math.max(...scores) : null;
|
| 410 |
+
|
| 411 |
+
$("#t2i-body").innerHTML = withScore.map(({ m, score }, i) => {
|
| 412 |
const rank = i + 1;
|
| 413 |
+
const flagNote = benches.map((b) => m.runs && m.runs[b.id] && m.runs[b.id].notes).find(Boolean);
|
| 414 |
return `<tr${flagNote ? ` title="${esc(flagNote)}"` : ""}>
|
| 415 |
<td class="rank rank-${rank <= 3 ? rank : "n"}">#${rank}</td>
|
| 416 |
<td class="model-cell">${m.url ? `<a href="${esc(m.url)}" target="_blank" rel="noopener">${esc(m.name)}</a>` : esc(m.name)}${flagNote ? ' <span class="flag-dot" title="' + esc(flagNote) + '">β </span>' : ""}</td>
|
| 417 |
<td>${orgTag(m.org)}</td>
|
| 418 |
<td class="num">${fmtParams(m.params_b)}</td>
|
| 419 |
+
<td class="num score composite${numeric(score) && score === scoreBest ? " best" : ""}">${numeric(score) ? score.toFixed(1) : '<span class="na">β</span>'}</td>
|
| 420 |
<td class="res">${esc(m.resolution || "β")}</td>
|
| 421 |
${benches.map((b, j) => {
|
| 422 |
const v = t2iRunValue(m, b.id);
|
|
|
|
| 427 |
<td class="res">${esc(m.release_date || "β")}</td>
|
| 428 |
</tr>`;
|
| 429 |
}).join("");
|
| 430 |
+
|
| 431 |
+
// mobile cards, tappable like the main table's mobile cards
|
| 432 |
+
$("#t2i-cards").innerHTML = withScore.map(({ m, score }, i) => {
|
| 433 |
+
const rank = i + 1;
|
| 434 |
+
const flagNote = benches.map((b) => m.runs && m.runs[b.id] && m.runs[b.id].notes).find(Boolean);
|
| 435 |
+
const open = state.expanded === `t2i:${m.id}`;
|
| 436 |
+
return `<div class="t2i-m-card${open ? " open" : ""}" data-id="${esc(m.id)}">
|
| 437 |
+
<div class="m-card-top t2i-m-card-top">
|
| 438 |
+
<span style="display:flex;align-items:center;gap:9px;min-width:0;">
|
| 439 |
+
<span class="rank rank-${rank <= 3 ? rank : "n"}">#${rank}</span>
|
| 440 |
+
${m.url ? `<a href="${esc(m.url)}" target="_blank" rel="noopener" onclick="event.stopPropagation()">${esc(m.name)}</a>` : `<span>${esc(m.name)}</span>`}
|
| 441 |
+
${flagNote ? ' <span class="flag-dot" title="' + esc(flagNote) + '">β </span>' : ""}
|
| 442 |
+
</span>
|
| 443 |
+
<span class="expand-hint">βΆ</span>
|
| 444 |
+
</div>
|
| 445 |
+
<div class="t2i-m-card-meta">${orgTag(m.org)}
|
| 446 |
+
<span class="params">${fmtParams(m.params_b)}</span>
|
| 447 |
+
<span class="res">${esc(m.resolution || "β")}</span>
|
| 448 |
+
<span class="date">${esc(m.release_date || "β")}</span>
|
| 449 |
+
</div>
|
| 450 |
+
<div class="t2i-m-scores">
|
| 451 |
+
<div class="t2i-m-score composite"><div class="k">Score</div><div class="v${numeric(score) && score === scoreBest ? " best" : ""}">${numeric(score) ? score.toFixed(1) : "β"}</div></div>
|
| 452 |
+
${benches.map((b, j) => {
|
| 453 |
+
const v = t2iRunValue(m, b.id);
|
| 454 |
+
const best = numeric(v) && v === ranges[j].best;
|
| 455 |
+
const decimals = b.id === "t2i-clip-coco" ? 4 : 2;
|
| 456 |
+
return `<div class="t2i-m-score"><div class="k">${esc(b.label)}</div><div class="v${best ? " best" : ""}">${numeric(v) ? v.toFixed(decimals) : "β"}</div></div>`;
|
| 457 |
+
}).join("")}
|
| 458 |
+
</div>
|
| 459 |
+
${open ? `<div class="t2i-m-card-detail">${flagNote ? `<p style="font-size:0.78rem;color:var(--muted);line-height:1.5;">${esc(flagNote)}</p>` : `<p style="font-size:0.78rem;color:var(--muted-2);font-style:italic;">No additional notes.</p>`}</div>` : ""}
|
| 460 |
+
</div>`;
|
| 461 |
+
}).join("");
|
| 462 |
+
|
| 463 |
+
document.querySelectorAll("#t2i-cards .t2i-m-card").forEach((card) =>
|
| 464 |
+
card.addEventListener("click", () => {
|
| 465 |
+
const key = `t2i:${card.dataset.id}`;
|
| 466 |
+
state.expanded = state.expanded === key ? null : key;
|
| 467 |
+
renderT2i();
|
| 468 |
+
})
|
| 469 |
+
);
|
| 470 |
}
|
| 471 |
|
| 472 |
// ---------------------------------------------------------------------
|