Upload index.html with huggingface_hub
Browse files- index.html +105 -76
index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
<style>
|
| 9 |
*{margin:0;padding:0;box-sizing:border-box}
|
| 10 |
body{background:#08080a;color:#fff;font-family:system-ui,sans-serif;min-height:100vh}
|
| 11 |
-
.wrap{max-width:
|
| 12 |
h1{font-size:28px;font-weight:900;margin-bottom:4px}
|
| 13 |
.sub{font-size:12px;color:rgba(255,255,255,0.4);margin-bottom:20px}
|
| 14 |
.controls{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}
|
|
@@ -16,17 +16,17 @@ h1{font-size:28px;font-weight:900;margin-bottom:4px}
|
|
| 16 |
.controls select{background:#111;border:1px solid #222;border-radius:6px;padding:10px;color:#fff;font-family:monospace}
|
| 17 |
.controls button{background:#00ff88;color:#000;border:none;border-radius:6px;padding:10px 24px;font-weight:700;cursor:pointer}
|
| 18 |
.controls button:disabled{opacity:0.3;cursor:wait}
|
| 19 |
-
.hashbar{display:flex;gap:8px;margin-bottom:
|
| 20 |
-
.hcell{flex:1;min-width:
|
| 21 |
-
.hcell .lbl{font-size:
|
| 22 |
-
.hcell .val{font-size:
|
| 23 |
.hcell.match{border-color:rgba(0,255,136,0.4)}.hcell.match .val{color:#00ff88}
|
| 24 |
.hcell.miss{border-color:rgba(255,59,48,0.4)}.hcell.miss .val{color:#ff3b30}
|
| 25 |
.row-label{font-family:monospace;font-size:11px;font-weight:700;letter-spacing:2px;text-transform:uppercase;margin-bottom:8px;display:flex;align-items:center;gap:8px}
|
| 26 |
.row-label .dot{width:8px;height:8px;border-radius:50%;display:inline-block}
|
| 27 |
.row-label.van .dot{background:#ff3b30}.row-label.van{color:rgba(255,59,48,0.7)}
|
| 28 |
.row-label.psec .dot{background:#00ff88}.row-label.psec{color:rgba(0,255,136,0.7)}
|
| 29 |
-
.gpu-row{display:grid;grid-template-columns:repeat(
|
| 30 |
.panel{background:#111;border:1px solid #222;border-radius:10px;overflow:hidden}
|
| 31 |
.panel.ok{border-color:rgba(0,255,136,0.3)}.panel.bad{border-color:rgba(255,59,48,0.2)}
|
| 32 |
.panel.cant{border-color:rgba(255,255,255,0.06);opacity:0.4}
|
|
@@ -50,23 +50,24 @@ h1{font-size:28px;font-weight:900;margin-bottom:4px}
|
|
| 50 |
.foot a{color:rgba(255,255,255,0.4);text-decoration:none}
|
| 51 |
@keyframes blink{50%{opacity:0}}
|
| 52 |
.cursor{display:inline-block;width:6px;height:13px;background:#00ff88;animation:blink 1s step-end infinite;vertical-align:text-bottom}
|
| 53 |
-
@media(max-width:
|
| 54 |
</style>
|
| 55 |
</head>
|
| 56 |
<body>
|
| 57 |
<div class="wrap">
|
| 58 |
<h1>PARADATUM</h1>
|
| 59 |
-
<div class="sub">PSEC · Cross-Architecture Determinism · Qwen 2.5 14B BF16 · Lossless</div>
|
| 60 |
<div class="controls">
|
| 61 |
<input id="prompt" value="The capital of France is">
|
| 62 |
<select id="mt"><option value="20">20 tok</option><option value="50">50 tok</option><option value="100">100 tok</option></select>
|
| 63 |
<button id="btn" onclick="go()">Run All GPUs</button>
|
| 64 |
</div>
|
| 65 |
-
<div class="hashbar" id="hashbar"></div>
|
| 66 |
|
| 67 |
<div class="row-label van"><span class="dot"></span> VANILLA llama.cpp (unmodified)</div>
|
| 68 |
<div class="gpu-row" id="vanRow"></div>
|
| 69 |
|
|
|
|
|
|
|
| 70 |
<div class="row-label psec"><span class="dot"></span> PSEC DETERMINISTIC (lossless)</div>
|
| 71 |
<div class="gpu-row" id="psecRow"></div>
|
| 72 |
|
|
@@ -79,110 +80,138 @@ h1{font-size:28px;font-weight:900;margin-bottom:4px}
|
|
| 79 |
<script type="module">
|
| 80 |
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
|
| 81 |
|
| 82 |
-
const
|
| 83 |
-
{col:'L4',vram:'24 GB',maxV:22.5},
|
| 84 |
-
{col:'L40S',vram:'48 GB',maxV:45.0},
|
| 85 |
-
{col:'A100',vram:'80 GB',maxV:80.0},
|
|
|
|
| 86 |
];
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
};
|
|
|
|
| 95 |
const GOLD='7890ca4cb74e422e';
|
| 96 |
let res={},tpsChart,vramChart;
|
| 97 |
|
| 98 |
-
function panelHTML(id,gpu,
|
| 99 |
-
if(!canRun) return
|
| 100 |
-
return
|
| 101 |
-
<div class="phdr"><div><b>${gpu.col}</b> <span class="meta">${gpu.vram}</span></div></div>
|
| 102 |
-
<div class="pstats">
|
| 103 |
-
<div class="st"><div class="sl">VRAM</div><div class="sv" id="v_${id}">—</div></div>
|
| 104 |
-
<div class="st"><div class="sl">Speed</div><div class="sv" id="s_${id}">—</div></div>
|
| 105 |
-
<div class="st"><div class="sl">Latency</div><div class="sv" id="lat_${id}">—</div></div>
|
| 106 |
-
<div class="st"><div class="sl">Hash</div><div class="sv" id="hash_${id}" style="font-size:11px">—</div></div>
|
| 107 |
-
</div>
|
| 108 |
-
<div class="term" id="t_${id}"><span style="color:rgba(255,255,255,0.15)">Ready</span></div>
|
| 109 |
-
</div>`;
|
| 110 |
}
|
| 111 |
|
| 112 |
function init(){
|
| 113 |
document.getElementById('vanRow').innerHTML=
|
| 114 |
-
panelHTML('van_l4',
|
| 115 |
-
panelHTML('van_l40s',
|
| 116 |
-
panelHTML('van_a100',
|
|
|
|
| 117 |
document.getElementById('psecRow').innerHTML=
|
| 118 |
-
panelHTML('psec_l4',
|
| 119 |
-
panelHTML('psec_l40s',
|
| 120 |
-
panelHTML('psec_a100',
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
|
| 126 |
const lo=(yl)=>({responsive:true,maintainAspectRatio:false,interaction:{mode:'index',intersect:false},plugins:{legend:{labels:{color:'rgba(255,255,255,0.5)',font:{family:'monospace',size:10},usePointStyle:true,pointStyle:'circle'}}},scales:{x:{ticks:{color:'#555',font:{family:'monospace',size:10}},grid:{color:'rgba(255,255,255,0.03)'}},y:{ticks:{color:'#555',font:{family:'monospace',size:10}},grid:{color:'rgba(255,255,255,0.05)'},title:{display:true,text:yl,color:'#444',font:{family:'monospace',size:10}}}}});
|
| 127 |
tpsChart=new Chart(document.getElementById('tpsChart').getContext('2d'),{type:'line',data:{labels:[],datasets:[]},options:lo('tok/s')});
|
| 128 |
vramChart=new Chart(document.getElementById('vramChart').getContext('2d'),{type:'line',data:{labels:[],datasets:[]},options:lo('GB')});
|
| 129 |
}
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
const term=document.getElementById('t_'+id);
|
| 135 |
-
const isPsec=id.startsWith('psec');
|
| 136 |
-
term.innerHTML='<span style="color:#555">Connecting...</span>';
|
| 137 |
-
try{
|
| 138 |
-
const client=await Client.connect(sp.space);
|
| 139 |
-
term.innerHTML='<span style="color:#555">Running...</span>';
|
| 140 |
const result=await client.predict("//infer",{prompt:prompt,max_tokens:mt});
|
| 141 |
const d=result.data;
|
| 142 |
let text,hash,vram,speed,lat;
|
| 143 |
if(isPsec&&d.length>=6){[text,hash,,vram,speed,lat]=d;}
|
| 144 |
else{[text,hash,vram,speed,lat]=d;}
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
term.textContent='';
|
| 147 |
-
let i=0;const chars=(text||'').split('');
|
| 148 |
-
const rv=()=>{if(i<chars.length){term.textContent+=chars[i];i++;setTimeout(rv,Math.random()*5+1);}else{term.innerHTML+=
|
| 149 |
-
//
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
document.getElementById('
|
| 153 |
-
document.getElementById('v_'+id).textContent=vram||'—';
|
| 154 |
-
document.getElementById('lat_'+id).textContent=lat||'—';
|
| 155 |
const hel=document.getElementById('hash_'+id);
|
| 156 |
-
hel.textContent=hash||'—';
|
| 157 |
-
hel.className='sv'+(isPsec&&hash===GOLD?' g':' r');
|
| 158 |
-
|
| 159 |
-
document.getElementById('p_'+id).className='panel '+(isPsec&&hash===GOLD?'ok':'bad');
|
| 160 |
-
// hash bar
|
| 161 |
if(isPsec){
|
| 162 |
const hv=document.getElementById('hv_'+id);
|
| 163 |
-
if(hv){hv.textContent=hash;
|
| 164 |
-
document.getElementById('h_'+id).className='hcell '+(hash===GOLD?'match':'miss');}
|
| 165 |
}
|
| 166 |
-
res[id]={hash,speed:
|
| 167 |
}catch(e){
|
| 168 |
-
term.innerHTML=
|
|
|
|
| 169 |
res[id]={hash:'ERR',speed:0,vramUsed:0};
|
| 170 |
}
|
| 171 |
}
|
| 172 |
|
| 173 |
function updateCharts(){
|
| 174 |
-
const labels=['L4 (24GB)','L40S (48GB)','A100 (80GB)'];
|
| 175 |
tpsChart.data.labels=labels;
|
| 176 |
tpsChart.data.datasets=[
|
| 177 |
-
{label:'PSEC',data:[res.psec_l4?.speed||0,res.psec_l40s?.speed||0,res.psec_a100?.speed||0],borderColor:'#00ff88',backgroundColor:'rgba(0,255,136,0.08)',pointBackgroundColor:'#00ff88',pointRadius:6,tension:0.3,fill:true,borderWidth:2},
|
| 178 |
-
{label:'Vanilla',data:[null,res.van_l40s?.speed||0,res.van_a100?.speed||0],borderColor:'#ff3b30',backgroundColor:'rgba(255,59,48,0.05)',pointBackgroundColor:'#ff3b30',pointRadius:6,tension:0.3,fill:true,borderWidth:2,spanGaps:false}
|
| 179 |
];
|
| 180 |
tpsChart.update();
|
| 181 |
vramChart.data.labels=labels;
|
| 182 |
vramChart.data.datasets=[
|
| 183 |
-
{label:'PSEC',data:[res.psec_l4?.vramUsed||0,res.psec_l40s?.vramUsed||0,res.psec_a100?.vramUsed||0],borderColor:'#00ff88',backgroundColor:'rgba(0,255,136,0.08)',pointBackgroundColor:'#00ff88',pointRadius:6,tension:0.3,fill:true,borderWidth:2},
|
| 184 |
-
{label:'Vanilla',data:[null,res.van_l40s?.vramUsed||0,res.van_a100?.vramUsed||0],borderColor:'#ff3b30',backgroundColor:'rgba(255,59,48,0.05)',pointBackgroundColor:'#ff3b30',pointRadius:6,tension:0.3,fill:true,borderWidth:2,spanGaps:false},
|
| 185 |
-
{label:'GPU Max',data:[22.5,45,80],borderColor:'rgba(255,255,255,0.12)',pointBackgroundColor:'rgba(255,255,255,0.2)',pointRadius:3,borderWidth:1,borderDash:[4,4],fill:false}
|
| 186 |
];
|
| 187 |
vramChart.update();
|
| 188 |
}
|
|
@@ -193,7 +222,7 @@ btn.disabled=true;btn.textContent='Running...';
|
|
| 193 |
res={};
|
| 194 |
const p=document.getElementById('prompt').value.trim();
|
| 195 |
const mt=parseInt(document.getElementById('mt').value);
|
| 196 |
-
const ids=
|
| 197 |
await Promise.allSettled(ids.map(id=>run1(id,p,mt)));
|
| 198 |
updateCharts();
|
| 199 |
btn.disabled=false;btn.textContent='Run All GPUs';
|
|
|
|
| 8 |
<style>
|
| 9 |
*{margin:0;padding:0;box-sizing:border-box}
|
| 10 |
body{background:#08080a;color:#fff;font-family:system-ui,sans-serif;min-height:100vh}
|
| 11 |
+
.wrap{max-width:1600px;margin:0 auto;padding:20px}
|
| 12 |
h1{font-size:28px;font-weight:900;margin-bottom:4px}
|
| 13 |
.sub{font-size:12px;color:rgba(255,255,255,0.4);margin-bottom:20px}
|
| 14 |
.controls{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap}
|
|
|
|
| 16 |
.controls select{background:#111;border:1px solid #222;border-radius:6px;padding:10px;color:#fff;font-family:monospace}
|
| 17 |
.controls button{background:#00ff88;color:#000;border:none;border-radius:6px;padding:10px 24px;font-weight:700;cursor:pointer}
|
| 18 |
.controls button:disabled{opacity:0.3;cursor:wait}
|
| 19 |
+
.hashbar{display:flex;gap:8px;margin-bottom:16px;flex-wrap:wrap}
|
| 20 |
+
.hcell{flex:1;min-width:120px;background:#111;border:1px solid #222;border-radius:8px;padding:8px 10px;text-align:center}
|
| 21 |
+
.hcell .lbl{font-size:9px;color:rgba(255,255,255,0.4);text-transform:uppercase;letter-spacing:1px;font-family:monospace}
|
| 22 |
+
.hcell .val{font-size:12px;font-family:monospace;font-weight:600;margin-top:2px;min-height:18px;color:rgba(255,255,255,0.15)}
|
| 23 |
.hcell.match{border-color:rgba(0,255,136,0.4)}.hcell.match .val{color:#00ff88}
|
| 24 |
.hcell.miss{border-color:rgba(255,59,48,0.4)}.hcell.miss .val{color:#ff3b30}
|
| 25 |
.row-label{font-family:monospace;font-size:11px;font-weight:700;letter-spacing:2px;text-transform:uppercase;margin-bottom:8px;display:flex;align-items:center;gap:8px}
|
| 26 |
.row-label .dot{width:8px;height:8px;border-radius:50%;display:inline-block}
|
| 27 |
.row-label.van .dot{background:#ff3b30}.row-label.van{color:rgba(255,59,48,0.7)}
|
| 28 |
.row-label.psec .dot{background:#00ff88}.row-label.psec{color:rgba(0,255,136,0.7)}
|
| 29 |
+
.gpu-row{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:16px}
|
| 30 |
.panel{background:#111;border:1px solid #222;border-radius:10px;overflow:hidden}
|
| 31 |
.panel.ok{border-color:rgba(0,255,136,0.3)}.panel.bad{border-color:rgba(255,59,48,0.2)}
|
| 32 |
.panel.cant{border-color:rgba(255,255,255,0.06);opacity:0.4}
|
|
|
|
| 50 |
.foot a{color:rgba(255,255,255,0.4);text-decoration:none}
|
| 51 |
@keyframes blink{50%{opacity:0}}
|
| 52 |
.cursor{display:inline-block;width:6px;height:13px;background:#00ff88;animation:blink 1s step-end infinite;vertical-align:text-bottom}
|
| 53 |
+
@media(max-width:1000px){.gpu-row{grid-template-columns:repeat(2,1fr)}.charts{grid-template-columns:1fr}}
|
| 54 |
</style>
|
| 55 |
</head>
|
| 56 |
<body>
|
| 57 |
<div class="wrap">
|
| 58 |
<h1>PARADATUM</h1>
|
| 59 |
+
<div class="sub">PSEC · Cross-Architecture Determinism · Qwen 2.5 14B BF16 · Lossless · 4 GPU Architectures</div>
|
| 60 |
<div class="controls">
|
| 61 |
<input id="prompt" value="The capital of France is">
|
| 62 |
<select id="mt"><option value="20">20 tok</option><option value="50">50 tok</option><option value="100">100 tok</option></select>
|
| 63 |
<button id="btn" onclick="go()">Run All GPUs</button>
|
| 64 |
</div>
|
|
|
|
| 65 |
|
| 66 |
<div class="row-label van"><span class="dot"></span> VANILLA llama.cpp (unmodified)</div>
|
| 67 |
<div class="gpu-row" id="vanRow"></div>
|
| 68 |
|
| 69 |
+
<div class="hashbar" id="hashbar"></div>
|
| 70 |
+
|
| 71 |
<div class="row-label psec"><span class="dot"></span> PSEC DETERMINISTIC (lossless)</div>
|
| 72 |
<div class="gpu-row" id="psecRow"></div>
|
| 73 |
|
|
|
|
| 80 |
<script type="module">
|
| 81 |
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
|
| 82 |
|
| 83 |
+
const COLS=[
|
| 84 |
+
{col:'L4',vram:'24 GB',maxV:22.5,arch:'Ada'},
|
| 85 |
+
{col:'L40S',vram:'48 GB',maxV:45.0,arch:'Ada'},
|
| 86 |
+
{col:'A100',vram:'80 GB',maxV:80.0,arch:'Ampere'},
|
| 87 |
+
{col:'H100',vram:'80 GB',maxV:80.0,arch:'Hopper'},
|
| 88 |
];
|
| 89 |
+
|
| 90 |
+
// Spaces (Gradio API via @gradio/client)
|
| 91 |
+
const HF={
|
| 92 |
+
van_l40s:'Paradatum/vanilla-qwen14b-l40s',
|
| 93 |
+
van_a100:'Paradatum/vanilla-qwen14b-a100',
|
| 94 |
+
psec_l4:'Paradatum/impossible-demo-v1',
|
| 95 |
+
psec_l40s:'Paradatum/psec-qwen14b-l40s',
|
| 96 |
+
psec_a100:'Paradatum/psec-qwen14b-a100',
|
| 97 |
+
};
|
| 98 |
+
|
| 99 |
+
// RunPod direct endpoints (raw llama-server /completion)
|
| 100 |
+
const RP={
|
| 101 |
+
van_h100:'https://8kft69gfos7lb7-8002.proxy.runpod.net/completion',
|
| 102 |
+
psec_h100:'https://8kft69gfos7lb7-8003.proxy.runpod.net/completion',
|
| 103 |
};
|
| 104 |
+
|
| 105 |
const GOLD='7890ca4cb74e422e';
|
| 106 |
let res={},tpsChart,vramChart;
|
| 107 |
|
| 108 |
+
function panelHTML(id,gpu,canRun){
|
| 109 |
+
if(!canRun) return '<div class="panel cant" id="p_'+id+'"><div class="phdr"><div><b>'+gpu.col+'</b> <span class="meta">'+gpu.vram+' · '+gpu.arch+'</span></div></div><div class="cantfit">28GB model<br>can\'t fit in 24GB VRAM</div></div>';
|
| 110 |
+
return '<div class="panel" id="p_'+id+'"><div class="phdr"><div><b>'+gpu.col+'</b> <span class="meta">'+gpu.vram+' · '+gpu.arch+'</span></div></div><div class="pstats"><div class="st"><div class="sl">VRAM</div><div class="sv" id="v_'+id+'">—</div></div><div class="st"><div class="sl">Speed</div><div class="sv" id="s_'+id+'">—</div></div><div class="st"><div class="sl">Latency</div><div class="sv" id="lat_'+id+'">—</div></div><div class="st"><div class="sl">Hash</div><div class="sv" id="hash_'+id+'" style="font-size:11px">—</div></div></div><div class="term" id="t_'+id+'"><span style="color:rgba(255,255,255,0.15)">Ready</span></div></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
|
| 113 |
function init(){
|
| 114 |
document.getElementById('vanRow').innerHTML=
|
| 115 |
+
panelHTML('van_l4',COLS[0],false)+
|
| 116 |
+
panelHTML('van_l40s',COLS[1],true)+
|
| 117 |
+
panelHTML('van_a100',COLS[2],true)+
|
| 118 |
+
panelHTML('van_h100',COLS[3],true);
|
| 119 |
document.getElementById('psecRow').innerHTML=
|
| 120 |
+
panelHTML('psec_l4',COLS[0],true)+
|
| 121 |
+
panelHTML('psec_l40s',COLS[1],true)+
|
| 122 |
+
panelHTML('psec_a100',COLS[2],true)+
|
| 123 |
+
panelHTML('psec_h100',COLS[3],true);
|
| 124 |
+
document.getElementById('hashbar').innerHTML=
|
| 125 |
+
['psec_l4','psec_l40s','psec_a100','psec_h100'].map((id,i)=>
|
| 126 |
+
'<div class="hcell" id="h_'+id+'"><div class="lbl">PSEC '+COLS[i].col+'</div><div class="val" id="hv_'+id+'">····</div></div>').join('');
|
| 127 |
|
| 128 |
const lo=(yl)=>({responsive:true,maintainAspectRatio:false,interaction:{mode:'index',intersect:false},plugins:{legend:{labels:{color:'rgba(255,255,255,0.5)',font:{family:'monospace',size:10},usePointStyle:true,pointStyle:'circle'}}},scales:{x:{ticks:{color:'#555',font:{family:'monospace',size:10}},grid:{color:'rgba(255,255,255,0.03)'}},y:{ticks:{color:'#555',font:{family:'monospace',size:10}},grid:{color:'rgba(255,255,255,0.05)'},title:{display:true,text:yl,color:'#444',font:{family:'monospace',size:10}}}}});
|
| 129 |
tpsChart=new Chart(document.getElementById('tpsChart').getContext('2d'),{type:'line',data:{labels:[],datasets:[]},options:lo('tok/s')});
|
| 130 |
vramChart=new Chart(document.getElementById('vramChart').getContext('2d'),{type:'line',data:{labels:[],datasets:[]},options:lo('GB')});
|
| 131 |
}
|
| 132 |
|
| 133 |
+
// Call HF Space via Gradio client
|
| 134 |
+
async function callHF(space,prompt,mt,isPsec){
|
| 135 |
+
const client=await Client.connect(space);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
const result=await client.predict("//infer",{prompt:prompt,max_tokens:mt});
|
| 137 |
const d=result.data;
|
| 138 |
let text,hash,vram,speed,lat;
|
| 139 |
if(isPsec&&d.length>=6){[text,hash,,vram,speed,lat]=d;}
|
| 140 |
else{[text,hash,vram,speed,lat]=d;}
|
| 141 |
+
return{text,hash,vram,speed:parseFloat(speed)||0,lat,vramNum:parseFloat(vram)||0};
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
// Call RunPod via raw /completion + compute hash
|
| 145 |
+
async function callRP(url,prompt,mt){
|
| 146 |
+
const body={prompt:prompt,n_predict:mt,temperature:0,n_probs:5,cache_prompt:false,slot_id:0};
|
| 147 |
+
const r=await fetch(url,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)});
|
| 148 |
+
if(!r.ok) throw new Error(r.status);
|
| 149 |
+
const d=await r.json();
|
| 150 |
+
// Compute logprob hash client-side
|
| 151 |
+
const probs=d.completion_probabilities||[];
|
| 152 |
+
const buf=new ArrayBuffer(probs.length*8);
|
| 153 |
+
const view=new DataView(buf);
|
| 154 |
+
probs.forEach((t,i)=>view.setFloat64(i*8,t.logprob,false));
|
| 155 |
+
const hashBuf=await crypto.subtle.digest('SHA-256',buf);
|
| 156 |
+
const hashArr=Array.from(new Uint8Array(hashBuf));
|
| 157 |
+
const hashHex=hashArr.map(b=>b.toString(16).padStart(2,'0')).join('').slice(0,16);
|
| 158 |
+
const tps=d.timings?.predicted_per_second||0;
|
| 159 |
+
const pTime=(d.timings?.prompt_ms||0)/1000;
|
| 160 |
+
const gTime=(d.timings?.predicted_ms||0)/1000;
|
| 161 |
+
// Get VRAM via nvidia-smi proxy — not available, estimate from model
|
| 162 |
+
return{text:d.content||'',hash:hashHex,speed:tps,lat:(pTime+gTime).toFixed(2),vram:'—',vramNum:0};
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
async function run1(id,prompt,mt){
|
| 166 |
+
const term=document.getElementById('t_'+id);
|
| 167 |
+
const isPsec=id.startsWith('psec');
|
| 168 |
+
term.innerHTML='<span style="color:#555">Connecting...</span>';
|
| 169 |
+
try{
|
| 170 |
+
let r;
|
| 171 |
+
if(HF[id]){
|
| 172 |
+
r=await callHF(HF[id],prompt,mt,isPsec);
|
| 173 |
+
} else if(RP[id]){
|
| 174 |
+
term.innerHTML='<span style="color:#555">Running (RunPod)...</span>';
|
| 175 |
+
r=await callRP(RP[id],prompt,mt);
|
| 176 |
+
} else return;
|
| 177 |
+
|
| 178 |
+
// Text reveal
|
| 179 |
term.textContent='';
|
| 180 |
+
let i=0;const chars=(r.text||'').split('');
|
| 181 |
+
const rv=()=>{if(i<chars.length){term.textContent+=chars[i];i++;setTimeout(rv,Math.random()*5+1);}else{term.innerHTML+='<span class="cursor"></span>';}};rv();
|
| 182 |
+
// Stats
|
| 183 |
+
document.getElementById('s_'+id).innerHTML='<span class="'+(isPsec?'g':'')+'">'+r.speed.toFixed(1)+' tok/s</span>';
|
| 184 |
+
document.getElementById('v_'+id).textContent=r.vram||'—';
|
| 185 |
+
document.getElementById('lat_'+id).textContent=r.lat||'—';
|
|
|
|
|
|
|
| 186 |
const hel=document.getElementById('hash_'+id);
|
| 187 |
+
hel.textContent=r.hash||'—';
|
| 188 |
+
hel.className='sv'+(isPsec&&r.hash===GOLD?' g':' r');
|
| 189 |
+
document.getElementById('p_'+id).className='panel '+(isPsec&&r.hash===GOLD?'ok':'bad');
|
|
|
|
|
|
|
| 190 |
if(isPsec){
|
| 191 |
const hv=document.getElementById('hv_'+id);
|
| 192 |
+
if(hv){hv.textContent=r.hash;document.getElementById('h_'+id).className='hcell '+(r.hash===GOLD?'match':'miss');}
|
|
|
|
| 193 |
}
|
| 194 |
+
res[id]={hash:r.hash,speed:r.speed,vramUsed:r.vramNum};
|
| 195 |
}catch(e){
|
| 196 |
+
term.innerHTML='<span style="color:#ff3b30">Error: '+e.message+'</span>';
|
| 197 |
+
document.getElementById('hv_'+id)&&(document.getElementById('hv_'+id).textContent='ERR');
|
| 198 |
res[id]={hash:'ERR',speed:0,vramUsed:0};
|
| 199 |
}
|
| 200 |
}
|
| 201 |
|
| 202 |
function updateCharts(){
|
| 203 |
+
const labels=['L4 (24GB)','L40S (48GB)','A100 (80GB)','H100 (80GB)'];
|
| 204 |
tpsChart.data.labels=labels;
|
| 205 |
tpsChart.data.datasets=[
|
| 206 |
+
{label:'PSEC',data:[res.psec_l4?.speed||0,res.psec_l40s?.speed||0,res.psec_a100?.speed||0,res.psec_h100?.speed||0],borderColor:'#00ff88',backgroundColor:'rgba(0,255,136,0.08)',pointBackgroundColor:'#00ff88',pointRadius:6,tension:0.3,fill:true,borderWidth:2},
|
| 207 |
+
{label:'Vanilla',data:[null,res.van_l40s?.speed||0,res.van_a100?.speed||0,res.van_h100?.speed||0],borderColor:'#ff3b30',backgroundColor:'rgba(255,59,48,0.05)',pointBackgroundColor:'#ff3b30',pointRadius:6,tension:0.3,fill:true,borderWidth:2,spanGaps:false}
|
| 208 |
];
|
| 209 |
tpsChart.update();
|
| 210 |
vramChart.data.labels=labels;
|
| 211 |
vramChart.data.datasets=[
|
| 212 |
+
{label:'PSEC',data:[res.psec_l4?.vramUsed||0,res.psec_l40s?.vramUsed||0,res.psec_a100?.vramUsed||0,res.psec_h100?.vramUsed||0],borderColor:'#00ff88',backgroundColor:'rgba(0,255,136,0.08)',pointBackgroundColor:'#00ff88',pointRadius:6,tension:0.3,fill:true,borderWidth:2},
|
| 213 |
+
{label:'Vanilla',data:[null,res.van_l40s?.vramUsed||0,res.van_a100?.vramUsed||0,res.van_h100?.vramUsed||0],borderColor:'#ff3b30',backgroundColor:'rgba(255,59,48,0.05)',pointBackgroundColor:'#ff3b30',pointRadius:6,tension:0.3,fill:true,borderWidth:2,spanGaps:false},
|
| 214 |
+
{label:'GPU Max',data:[22.5,45,80,80],borderColor:'rgba(255,255,255,0.12)',pointBackgroundColor:'rgba(255,255,255,0.2)',pointRadius:3,borderWidth:1,borderDash:[4,4],fill:false}
|
| 215 |
];
|
| 216 |
vramChart.update();
|
| 217 |
}
|
|
|
|
| 222 |
res={};
|
| 223 |
const p=document.getElementById('prompt').value.trim();
|
| 224 |
const mt=parseInt(document.getElementById('mt').value);
|
| 225 |
+
const ids=['van_l40s','van_a100','van_h100','psec_l4','psec_l40s','psec_a100','psec_h100'];
|
| 226 |
await Promise.allSettled(ids.map(id=>run1(id,p,mt)));
|
| 227 |
updateCharts();
|
| 228 |
btn.disabled=false;btn.textContent='Run All GPUs';
|