alana89 commited on
Commit
13df49e
·
verified ·
1 Parent(s): 4c1b622

Pareto: front names always shown; With emojis toggle (#237)

Browse files
Files changed (1) hide show
  1. index.html +13 -9
index.html CHANGED
@@ -342,7 +342,7 @@ let timeOf = {};
342
  // TAR's fine-tuning is part of training, so it always counts; encoding the rows is optional, as for frozen encoders.
343
  const computeTime = () => { timeOf = Object.fromEntries(D.cost.map(r => [r.entry, r.train_s_per_1k + r.finetune_s_per_1k + r.inference_s_per_1k + encodeOf(r)])); };
344
  computeTime();
345
- let showNames = store.get('pareto_names') !== '0';
346
  function drawEncTabs() {
347
  const box = document.getElementById('encTabs');
348
  const b = el('button', { type: 'button', title: "Estimate, from the cached encoders' own time", onclick: () => {
@@ -353,7 +353,11 @@ function drawEncTabs() {
353
  showNames = !showNames; store.set('pareto_names', showNames ? '1' : '0'); drawEncTabs(); render();
354
  } }, 'Show names');
355
  n.setAttribute('aria-pressed', showNames);
356
- box.replaceChildren(b, n);
 
 
 
 
357
  }
358
  drawEncTabs();
359
  function paretoFront(board) {
@@ -394,8 +398,9 @@ function drawPareto(board, front) {
394
  s += `<path d="${path}" fill="none" stroke="var(--warn)" stroke-width="1.6"/>`;
395
  // Front labels first, then the others wherever they fit; a label that fits nowhere is left to the tooltip.
396
  const boxes = [], hit = (b) => boxes.some(o => b.x0 < o.x1 && o.x0 < b.x1 && b.y0 < o.y1 && o.y0 < b.y1);
397
- // With both encodings on the board, the name carries the encoding's mark; with one, the model's name is enough.
398
- const name = r => encSel.length > 1 && ENC_MARK[r.encoding] ? `${r.model} ${ENC_MARK[r.encoding]}` : r.model;
 
399
  const place = (r, onFront) => {
400
  const px = x(timeOf[r.entry]), py = y(r.elo), w = name(r).length * (onFront ? 7 : 6.4), h = 12;
401
  const spots = onFront ? [[px - 10 - w, py - 9 - h]] : [[px + 8, py - 4], [px - 8 - w, py - 4], [px - w / 2, py - 18], [px - w / 2, py + 8]];
@@ -413,13 +418,12 @@ function drawPareto(board, front) {
413
  fr.forEach(r => {
414
  s += `<rect x="${x(timeOf[r.entry]) - 5.5}" y="${y(r.elo) - 5.5}" width="11" height="11" fill="${encColor(r.encoding)}" stroke="var(--warn)" stroke-width="2">${tip(r)}</rect>`;
415
  });
416
- if (showNames) {
417
- fr.forEach(r => { s += place(r, true); });
418
- [...rows].filter(r => !front.has(r.entry)).sort((a, b) => b.elo - a.elo).forEach(r => { s += place(r, false); });
419
- }
420
  let lx = left + 12;
421
  [...new Set(rows.map(r => r.encoding))].forEach(e => {
422
- const label = `${ENC_MARK[e] && showNames && encSel.length > 1 ? ENC_MARK[e] + ' ' : ''}${ENC_LABEL[e]}`;
423
  s += `<rect x="${lx}" y="${top + 6}" width="9" height="9" fill="${encColor(e)}"/><text x="${lx + 15}" y="${top + 15}">${label}</text>`;
424
  lx += 30 + label.length * 7;
425
  });
 
342
  // TAR's fine-tuning is part of training, so it always counts; encoding the rows is optional, as for frozen encoders.
343
  const computeTime = () => { timeOf = Object.fromEntries(D.cost.map(r => [r.entry, r.train_s_per_1k + r.finetune_s_per_1k + r.inference_s_per_1k + encodeOf(r)])); };
344
  computeTime();
345
+ let showNames = store.get('pareto_names') !== '0', withEmojis = store.get('pareto_emojis') !== '0';
346
  function drawEncTabs() {
347
  const box = document.getElementById('encTabs');
348
  const b = el('button', { type: 'button', title: "Estimate, from the cached encoders' own time", onclick: () => {
 
353
  showNames = !showNames; store.set('pareto_names', showNames ? '1' : '0'); drawEncTabs(); render();
354
  } }, 'Show names');
355
  n.setAttribute('aria-pressed', showNames);
356
+ const m = el('button', { type: 'button', title: '❄️ for Frozen and 🎯 for TAR, in place of the words', onclick: () => {
357
+ withEmojis = !withEmojis; store.set('pareto_emojis', withEmojis ? '1' : '0'); drawEncTabs(); render();
358
+ } }, 'With emojis');
359
+ m.setAttribute('aria-pressed', withEmojis);
360
+ box.replaceChildren(b, n, m);
361
  }
362
  drawEncTabs();
363
  function paretoFront(board) {
 
398
  s += `<path d="${path}" fill="none" stroke="var(--warn)" stroke-width="1.6"/>`;
399
  // Front labels first, then the others wherever they fit; a label that fits nowhere is left to the tooltip.
400
  const boxes = [], hit = (b) => boxes.some(o => b.x0 < o.x1 && o.x0 < b.x1 && b.y0 < o.y1 && o.y0 < b.y1);
401
+ // With both encodings on the board, a name carries its encoding, as a mark or a word; with one, the model is enough.
402
+ const name = r => encSel.length < 2 || !ENC_MARK[r.encoding] ? r.model
403
+ : withEmojis ? `${r.model} ${ENC_MARK[r.encoding]}` : r.entry;
404
  const place = (r, onFront) => {
405
  const px = x(timeOf[r.entry]), py = y(r.elo), w = name(r).length * (onFront ? 7 : 6.4), h = 12;
406
  const spots = onFront ? [[px - 10 - w, py - 9 - h]] : [[px + 8, py - 4], [px - 8 - w, py - 4], [px - w / 2, py - 18], [px - w / 2, py + 8]];
 
418
  fr.forEach(r => {
419
  s += `<rect x="${x(timeOf[r.entry]) - 5.5}" y="${y(r.elo) - 5.5}" width="11" height="11" fill="${encColor(r.encoding)}" stroke="var(--warn)" stroke-width="2">${tip(r)}</rect>`;
420
  });
421
+ // The front keeps its names; Show names adds the others.
422
+ fr.forEach(r => { s += place(r, true); });
423
+ if (showNames) [...rows].filter(r => !front.has(r.entry)).sort((a, b) => b.elo - a.elo).forEach(r => { s += place(r, false); });
 
424
  let lx = left + 12;
425
  [...new Set(rows.map(r => r.encoding))].forEach(e => {
426
+ const label = `${ENC_MARK[e] && withEmojis && encSel.length > 1 ? ENC_MARK[e] + ' ' : ''}${ENC_LABEL[e]}`;
427
  s += `<rect x="${lx}" y="${top + 6}" width="9" height="9" fill="${encColor(e)}"/><text x="${lx + 15}" y="${top + 15}">${label}</text>`;
428
  lx += 30 + label.length * 7;
429
  });