fix cost curve: x-axis starts at left edge (normalize log scale from minT to maxT)
Browse files
experiments/demo_server.py
CHANGED
|
@@ -523,7 +523,8 @@ function drawCC(data){const c=$("cc"),x=c.getContext("2d");c.width=c.clientWidth
|
|
| 523 |
const maxT=Math.max(...data.map(d=>d.T)),us=data.map(d=>d.us_per_token),
|
| 524 |
ce=data.map(d=>d.cells),maxU=Math.max(...us)*1.25,maxC=Math.max(...ce)*1.15,
|
| 525 |
maxA=Math.max(...data.map(d=>d.flops_attention_equiv));
|
| 526 |
-
const
|
|
|
|
| 527 |
Y=u=>H-30-(u/maxU)*(H-56),Y2=v=>H-30-(v/maxC)*(H-56),YA=v=>H-30-(v/maxA)*(H-56);
|
| 528 |
x.fillStyle="#fff";x.fillRect(0,0,W,H);x.strokeStyle="#eceef2";x.fillStyle="#6b7280";
|
| 529 |
x.font="11px -apple-system,sans-serif";
|
|
|
|
| 523 |
const maxT=Math.max(...data.map(d=>d.T)),us=data.map(d=>d.us_per_token),
|
| 524 |
ce=data.map(d=>d.cells),maxU=Math.max(...us)*1.25,maxC=Math.max(...ce)*1.15,
|
| 525 |
maxA=Math.max(...data.map(d=>d.flops_attention_equiv));
|
| 526 |
+
const minT=Math.min(...data.map(d=>d.T)),lgMin=Math.log(minT),lgMax=Math.log(maxT);
|
| 527 |
+
const X=t=>P+((Math.log(t)-lgMin)/(lgMax-lgMin||1))*(W-P-16),
|
| 528 |
Y=u=>H-30-(u/maxU)*(H-56),Y2=v=>H-30-(v/maxC)*(H-56),YA=v=>H-30-(v/maxA)*(H-56);
|
| 529 |
x.fillStyle="#fff";x.fillRect(0,0,W,H);x.strokeStyle="#eceef2";x.fillStyle="#6b7280";
|
| 530 |
x.font="11px -apple-system,sans-serif";
|