mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-13 16:17:54 +00:00
Feat: Calculate and display best performing temperature in gemini benchmark
This commit is contained in:
11
gemini.html
11
gemini.html
@@ -30,9 +30,11 @@
|
|||||||
const genTimes=await fetch('./results.json').then(r=>r.json());
|
const genTimes=await fetch('./results.json').then(r=>r.json());
|
||||||
const models=readme.match(/<!-- GEMINI_START -->\n([\s\S]+?)\n<!-- MODELS_END -->/)[1].trim().split('\n').filter(Boolean);
|
const models=readme.match(/<!-- GEMINI_START -->\n([\s\S]+?)\n<!-- MODELS_END -->/)[1].trim().split('\n').filter(Boolean);
|
||||||
const tests=[...new Set(Object.values(genTimes).flatMap(Object.keys))].sort();
|
const tests=[...new Set(Object.values(genTimes).flatMap(Object.keys))].sort();
|
||||||
|
const tStats={};
|
||||||
|
|
||||||
for(const model of models){
|
for(const model of models){
|
||||||
const sModel=model.replace(/[\/:]/g,'_');
|
const sModel=model.replace(/[\/:]/g,'_');
|
||||||
|
const temp=model.split('TEMP:')[1]?.trim();
|
||||||
const card=document.createElement('section');
|
const card=document.createElement('section');
|
||||||
card.className='rounded-2xl border border-gray-200 bg-white shadow-sm overflow-hidden';
|
card.className='rounded-2xl border border-gray-200 bg-white shadow-sm overflow-hidden';
|
||||||
card.innerHTML=`<div class="bg-gray-50 px-5 py-3 border-b border-gray-200"><p class="mono text-sm text-gray-700 font-medium">${model}</p></div><ul class="p-4 space-y-2" id="list-${sModel}"></ul>`;
|
card.innerHTML=`<div class="bg-gray-50 px-5 py-3 border-b border-gray-200"><p class="mono text-sm text-gray-700 font-medium">${model}</p></div><ul class="p-4 space-y-2" id="list-${sModel}"></ul>`;
|
||||||
@@ -55,7 +57,6 @@
|
|||||||
await Promise.race([
|
await Promise.race([
|
||||||
(async()=>{
|
(async()=>{
|
||||||
const tMod=await import(`./tests/${test}/test.js`);
|
const tMod=await import(`./tests/${test}/test.js`);
|
||||||
// Import from dedicated gemini output folder
|
|
||||||
const lMod=await import(`./tests/${test}/outputs_gemini/${sModel}.js`);
|
const lMod=await import(`./tests/${test}/outputs_gemini/${sModel}.js`);
|
||||||
await tMod.default.runTest(lMod.default);
|
await tMod.default.runTest(lMod.default);
|
||||||
})(),
|
})(),
|
||||||
@@ -66,12 +67,20 @@
|
|||||||
li.innerHTML=`${status} <span class="font-medium text-gray-800">${test}</span><span class="mono text-gray-500 ml-auto">${time.toFixed(3)}s</span>`;
|
li.innerHTML=`${status} <span class="font-medium text-gray-800">${test}</span><span class="mono text-gray-500 ml-auto">${time.toFixed(3)}s</span>`;
|
||||||
}
|
}
|
||||||
const ratio=tests.length?passed/tests.length:0;
|
const ratio=tests.length?passed/tests.length:0;
|
||||||
|
if(temp){tStats[temp]??={p:0,t:0};tStats[temp].p+=passed;tStats[temp].t+=tests.length}
|
||||||
const grade=gradeOf(ratio);
|
const grade=gradeOf(ratio);
|
||||||
const scoreLi=document.createElement('li');
|
const scoreLi=document.createElement('li');
|
||||||
scoreLi.className='mt-3 pt-3 border-t border-gray-200 flex items-center text-sm justify-between';
|
scoreLi.className='mt-3 pt-3 border-t border-gray-200 flex items-center text-sm justify-between';
|
||||||
scoreLi.innerHTML=`<span class="text-gray-600">Score</span><span class="flex items-center gap-3"><span class="mono text-gray-900 font-semibold">${passed}/${tests.length}</span><span class="inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-800">${grade}</span></span>`;
|
scoreLi.innerHTML=`<span class="text-gray-600">Score</span><span class="flex items-center gap-3"><span class="mono text-gray-900 font-semibold">${passed}/${tests.length}</span><span class="inline-flex items-center rounded-full bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-800">${grade}</span></span>`;
|
||||||
list.appendChild(scoreLi);
|
list.appendChild(scoreLi);
|
||||||
}
|
}
|
||||||
|
if(Object.keys(tStats).length){
|
||||||
|
const best=Object.entries(tStats).sort(([,a],[,b])=>b.p/b.t-a.p/a.t)[0];
|
||||||
|
const statDiv=document.createElement('div');
|
||||||
|
statDiv.className='mt-8 p-6 bg-white rounded-2xl border border-gray-200 shadow-sm text-center';
|
||||||
|
statDiv.innerHTML=`<h3 class="text-gray-500 font-medium text-sm uppercase tracking-wider mb-2">Best Temperature</h3><div class="text-3xl font-bold text-gray-900">${best[0]}</div><div class="text-sm text-gray-500 mt-1">Pass Rate: ${((best[1].p/best[1].t)*100).toFixed(1)}%</div>`;
|
||||||
|
container.appendChild(statDiv);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user