Spaces:
Running
Running
Trim parameter hover formatting in HF Space plots.
Browse filesUse compact parameter labels in plot hover text to match the main site formatting and remove trailing zeros.
Made-with: Cursor
main.js
CHANGED
|
@@ -70,6 +70,15 @@ function parseSizeToBillions(sizeStr) {
|
|
| 70 |
return null;
|
| 71 |
}
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
function inferFamily(name) {
|
| 74 |
const n = String(name || '').toLowerCase();
|
| 75 |
if (n.includes('stella') || n.includes('jasper')) return 'Stella';
|
|
@@ -243,8 +252,9 @@ function renderPlots() {
|
|
| 243 |
x: grouped[fam].x,
|
| 244 |
y: grouped[fam].y,
|
| 245 |
text: grouped[fam].text,
|
|
|
|
| 246 |
marker: { color: FAMILY_COLORS[fam] || '#9e9e9e', size: 11, line: { width: 1, color: '#fff' } },
|
| 247 |
-
hovertemplate: '<b>%{text}</b><br>Params: %{
|
| 248 |
}));
|
| 249 |
|
| 250 |
const bm25 = filtered.find(r => String(r.name).toLowerCase() === 'bm25');
|
|
|
|
| 70 |
return null;
|
| 71 |
}
|
| 72 |
|
| 73 |
+
function formatParameterSize(sizeInBillions) {
|
| 74 |
+
if (sizeInBillions === undefined || sizeInBillions === null || Number.isNaN(sizeInBillions)) return '-';
|
| 75 |
+
if (sizeInBillions < 1) {
|
| 76 |
+
const inMillions = sizeInBillions * 1000;
|
| 77 |
+
return `${parseFloat(inMillions.toFixed(2))}M`;
|
| 78 |
+
}
|
| 79 |
+
return `${parseFloat(sizeInBillions.toFixed(3))}B`;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
function inferFamily(name) {
|
| 83 |
const n = String(name || '').toLowerCase();
|
| 84 |
if (n.includes('stella') || n.includes('jasper')) return 'Stella';
|
|
|
|
| 252 |
x: grouped[fam].x,
|
| 253 |
y: grouped[fam].y,
|
| 254 |
text: grouped[fam].text,
|
| 255 |
+
customdata: grouped[fam].x.map(v => formatParameterSize(v)),
|
| 256 |
marker: { color: FAMILY_COLORS[fam] || '#9e9e9e', size: 11, line: { width: 1, color: '#fff' } },
|
| 257 |
+
hovertemplate: '<b>%{text}</b><br>Params: %{customdata}<br>Score: %{y:.3f}<extra></extra>'
|
| 258 |
}));
|
| 259 |
|
| 260 |
const bm25 = filtered.find(r => String(r.name).toLowerCase() === 'bm25');
|