Download monitor.js from idoru/inkling-2-mini-harness-adapters: direct link, hf CLI and curl.
- Browser
- Download file 19.1 kB
-
https://huggingface.co/spaces/idoru/inkling-2-mini-harness-adapters/resolve/main/monitor.js
- Command line
-
hf download hf://spaces/idoru/inkling-2-mini-harness-adapters/monitor.js
-
curl -L -o monitor.js https://huggingface.co/spaces/idoru/inkling-2-mini-harness-adapters/resolve/main/monitor.js
19.1 kB
| ; | |
| const source = "https://huggingface.co/buckets/idoru/inkling-2-mini-harness-runs/resolve/"; | |
| const stages = [ | |
| ["spending", "Compute spending and reservations"], | |
| ["trl-inkling-check", "Inkling support in the Hugging Face learner"], | |
| ["compatibility", "Trainer compatibility"], ["serving", "Rollout server compatibility"], | |
| ["runtime", "Full training runtime"], ["offline", "Offline TermGrade environment"], | |
| ["offline-check", "TermGrade guest boot and isolation"], | |
| ["termgrade-image", "TermGrade serial transport update"], ["termgrade-guest-check", "TermGrade transfer and harness checks"], | |
| ["harness-check", "Installed harness request routing"], | |
| ["automation-check", "AutomationBench simulator check"], ["automation-evaluation", "Business-workflow evaluation"], | |
| ["harness-scale-check", "Scale800 harness request routing"], | |
| ["harness-install-check", "Pinned OpenCode installation"], ["reference-scores", "Published Qwen reference scores"], | |
| ["harness-tools", "Pinned evaluation client"], | |
| ["eval-transport", "Evaluation capture and token budget check"], | |
| ["swe-image", "SWE-bench Pro evaluation environment"], | |
| ["swe-guest-check", "SWE-bench agent and verifier network check"], | |
| ["rollout", "Graded Pi rollout check"], ["pi-group", "Pi eight-sample TermGrade group"], | |
| ["native-config", "Native configuration and tokenizer"], | |
| ["native-check", "Native optimizer pilot"], | |
| ["pi-token-budget","Pi reference token-budget training"], ["hermes-token-budget","Hermes reference token-budget training"], | |
| ["opencode-token-budget","OpenCode reference token-budget training"], ["reference-batch-check","Reference batch measurements"], | |
| ["scoring-restore-check", "Distributed scoring checkpoint recovery"], | |
| ["native-auth", "Native trainer sandbox authorization"], | |
| ["group-optimizer", "Pi graded-group optimizer"], | |
| ["base-train-groups", "Pi first on-policy training batch"], ["release", "Verified public model releases"], | |
| ["other-train-groups", "Hermes and OpenCode training groups"], | |
| ["pi", "Pi training"], ["hermes", "Hermes Agent training"], | |
| ["opencode", "OpenCode training"], ["merge", "Adapter merge"], ["evaluation", "Paired evaluations"], | |
| ["base-evaluation", "Held-out frozen-model evaluation"], | |
| ]; | |
| const labels = {queued:"Queued", running:"Running", completed:"Completed", failed:"Failed", paused:"Paused"}; | |
| function element(tag, text, className) { | |
| const node = document.createElement(tag); | |
| if (text !== undefined) node.textContent = text; | |
| if (className) node.className = className; | |
| return node; | |
| } | |
| const rows = new Map(); | |
| const lastTrainingEvent = new Map(); | |
| const tokenBudgetRuns = new Map(); | |
| let referenceSteps = {}; | |
| let hardwareSnapshot; | |
| for (const [key, title] of stages) { | |
| const row = element("details"); | |
| const summary = element("summary"); | |
| const state = element("span", "Checking…", "state"); | |
| const body = element("div", "", "events"); | |
| summary.append(element("span", title, "name"), state); | |
| row.append(summary, body); | |
| document.getElementById("runs").append(row); | |
| rows.set(key, {state, body}); | |
| } | |
| function utc(date) { | |
| return new Date(date).toISOString().slice(0, 19).replace("T", " ") + " UTC"; | |
| } | |
| async function refreshStage(key) { | |
| const {state, body} = rows.get(key); | |
| try { | |
| const response = await fetch(source + key + ".json?t=" + Math.floor(Date.now()/15000), {cache:"no-store", credentials:"omit", signal:AbortSignal.timeout(10000)}); | |
| if (response.status === 404) { | |
| state.textContent = "Awaiting first event"; | |
| body.textContent = "This stage has no recorded measurements."; | |
| return true; | |
| } | |
| if (!response.ok) throw Error(response.status); | |
| const data = await response.json(); | |
| if (data.stage !== key || !Array.isArray(data.events) || !(data.state in labels)) throw Error("Invalid record"); | |
| if (["pi","hermes","opencode"].includes(key) && data.events.length) { | |
| lastTrainingEvent.set(key,{attempt:data.attempt,event:data.events.at(-1)}); | |
| } | |
| if (key.endsWith("-token-budget") && data.events.length) tokenBudgetRuns.set(key,data); | |
| state.className = "state " + data.state; | |
| state.textContent = labels[data.state]; | |
| const list = element("ol"); | |
| for (const event of data.events.slice().reverse()) { | |
| const item = element("li"); | |
| item.append(element("time", utc(event.time)), element("div", event.note)); | |
| const metrics = Object.entries(event.metrics || {}).map(([name,value]) => name + " " + Number(value).toLocaleString("en-US",{maximumSignificantDigits:6})); | |
| if (metrics.length) item.append(element("span",metrics.join(" · "),"metrics")); | |
| list.append(item); | |
| } | |
| body.replaceChildren(list); | |
| return true; | |
| } catch { | |
| state.textContent = "Update unavailable"; | |
| return false; | |
| } | |
| } | |
| async function update() { | |
| const statuses = await Promise.all([...stages.map(([key]) => refreshStage(key)),refreshHardware(),refreshResults(),refreshTraining()]); | |
| showTrainingPhases(); | |
| showTokenBudgetRuns(); | |
| document.getElementById("sync").textContent = (statuses.every(Boolean) ? "Checked " : "Some feeds unavailable · ") + utc(Date.now()); | |
| setTimeout(update, 15000); | |
| } | |
| const bucketIndex="https://huggingface.co/api/buckets/idoru/inkling-2-mini-harness-runs/tree"; | |
| let availableFiles=new Set(); | |
| let lastIndex=0; | |
| let qwenReference; | |
| async function publicJSON(url) { | |
| const res=await fetch(url,{credentials:"omit",cache:"no-store",signal:AbortSignal.timeout(8000)}); | |
| if (!res.ok) throw Error(res.status); | |
| return res.json(); | |
| } | |
| function linkTo(title,url) { | |
| const link=element("a",title); | |
| link.href=url; | |
| return link; | |
| } | |
| function showTokenBudgetRuns() { | |
| const result=document.createDocumentFragment(); | |
| for (const [stage,data] of tokenBudgetRuns) { | |
| const harness=stage.replace("-token-budget",""); | |
| const names={pi:"Pi",hermes:"Hermes Agent",opencode:"OpenCode"}; | |
| const selected=data.events.findLast(event=>event.metrics?.optimizer_step_in_progress); | |
| const saved=data.events.findLast(event=>event.metrics?.saved_step); | |
| const last=data.events.at(-1); | |
| const p=element("p"); | |
| p.append(linkTo(names[harness]+" · reference token budget",source+stage+".json"), | |
| document.createTextNode(" · "+labels[data.state])); | |
| if (selected) { | |
| const m=selected.metrics; | |
| p.append(element("span","Update "+m.optimizer_step_in_progress+" of "+(harness==="opencode"?150:160)+ | |
| " · "+m.reference_rows+" microbatches · "+m.unique_tokens.toLocaleString("en-US")+" distinct prefix tokens · "+ | |
| m.native_path_tokens.toLocaleString("en-US")+" input tokens across "+m.training_paths+" paths · "+ | |
| m.eligible_loss_tokens.toLocaleString("en-US")+" loss tokens","metrics")); | |
| } | |
| const step=Math.max(referenceSteps[stage] || 0,saved?.metrics?.saved_step || 0); | |
| if (step) p.append(element("span","Optimizer state saved at update "+step,"metrics")); | |
| p.append(element("span",last.note+" · "+utc(last.time),"metrics")); | |
| result.append(p); | |
| } | |
| document.getElementById("reference-rows").replaceChildren(result); | |
| } | |
| function showTrainingPhases() { | |
| const recent=hardwareSnapshot && Date.now()-Date.parse(hardwareSnapshot.as_of)<180000; | |
| for (const slot of document.querySelectorAll("[data-phase-for]")) { | |
| const stage=slot.dataset.phaseFor; | |
| const active=recent && hardwareSnapshot.jobs.find(job=>job.stage===stage); | |
| const record=lastTrainingEvent.get(stage); | |
| let message=""; | |
| if (record && (!active || record.attempt===active.attempt)) { | |
| const {event}=record; | |
| const m=event.metrics||{}; | |
| message=Number.isInteger(m.parts_in_forward_call) | |
| ? "Policy scoring · "+(m.new_parts+m.reused_parts)+" / "+m.parts_in_forward_call+ | |
| " native microbatches checkpointed on GPU rank 0 in this pass · "+m.reused_parts+" reused" | |
| : event.note; | |
| message+=" · "+utc(event.time); | |
| } | |
| if (recent && !active) message=(message?message+" · ":"")+"No active "+stage+" training worker"; | |
| if (active && (!record || record.attempt!==active.attempt)) message=active.hardware+" · "+active.state.toLowerCase(); | |
| slot.textContent=message; | |
| } | |
| } | |
| async function refreshTraining() { | |
| try { | |
| const res=await fetch(source+"training-progress.json?t="+Math.floor(Date.now()/15000),{credentials:"omit",cache:"no-store",signal:AbortSignal.timeout(8000)}); | |
| if (res.status===404) return true; | |
| if (!res.ok) throw Error(res.status); | |
| const d=await res.json(); | |
| referenceSteps=d.reference_saved_steps || {}; | |
| const names={pi:"Pi",hermes:"Hermes Agent",opencode:"OpenCode"}; | |
| let measured; | |
| try {measured=await publicJSON(source+"training-measurements.json?t="+Math.floor(Date.now()/15000));} catch {} | |
| const lines=d.specialists.map(row=>{ | |
| let label=names[row.harness]+" · fixed groups · "+row.saved_step+" / "+row.target_steps+" optimizer updates saved"; | |
| if (row.next_batch_size) label+=" · "+row.next_batch_saved+" / "+row.next_batch_size+" graded attempts saved for the next update"; | |
| const line=element("p",label); | |
| const phase=element("span","","metrics"); | |
| phase.dataset.phaseFor=row.harness; | |
| line.append(phase); | |
| const groups=Object.entries(row.by_source||{}).map(([name,group])=>{ | |
| const title={scale800:"Scale800",termgrade:"TermGrade"}[name]||name; | |
| return title+" "+group.saved+" / "+group.expected+" · "+group.complete_groups+" complete groups of eight"; | |
| }); | |
| if (groups.length) line.append(element("span",groups.join(" · "),"metrics")); | |
| const batch=measured?.batches.find(b=>b.harness===row.harness && b.batch_step===row.saved_step+1); | |
| if (batch?.graded_attempts) { | |
| line.append(element("span",batch.full_credit_attempts+" / "+batch.graded_attempts+" attempts earned full verifier credit · "+ | |
| batch.loss_mask_tokens.toLocaleString("en-US")+" tokens eligible for the training loss · "+ | |
| batch.groups_with_reward_variation+" / "+batch.complete_groups+" complete groups had varying rewards","metrics")); | |
| if (batch.full_credit_attempts && Number.isInteger(batch.full_credit_tool_calls)) { | |
| line.append(element("span",(batch.full_credit_tool_calls/batch.full_credit_attempts).toFixed(1)+ | |
| " tool calls per full-credit training attempt","metrics")); | |
| } | |
| if (Number.isInteger(batch.path_tokens) && Number.isInteger(batch.captured_paths)) { | |
| line.append(element("span",batch.path_tokens.toLocaleString("en-US")+" tokens across "+ | |
| batch.captured_paths.toLocaleString("en-US")+" captured training paths, including repeated prompt context","metrics")); | |
| } | |
| } | |
| return line; | |
| }); | |
| document.getElementById("training-rows").replaceChildren(...lines); | |
| document.getElementById("training-time").textContent="Checkpoint storage checked "+utc(d.as_of); | |
| document.getElementById("training").hidden=false; | |
| return true; | |
| } catch {return false;} | |
| } | |
| async function refreshResults() { | |
| try { | |
| const now=Date.now(); | |
| if (now-lastIndex>=60000) { | |
| const [objects,models]=await Promise.all([publicJSON(bucketIndex+"?limit=1000&t="+Math.floor(now/60000)), | |
| publicJSON("https://huggingface.co/api/models?author=idoru&search=Inkling-2-Mini-&limit=100")]); | |
| availableFiles=new Set(objects.map(x=>x.path)); | |
| if (!qwenReference && availableFiles.has("reference-qwen.json")) qwenReference=await publicJSON(source+"reference-qwen.json"); | |
| const allowed=new Set(["pi-native-pilot","pi-graded-group-pilot","pi-harness-adapter","hermes-harness-adapter","opencode-harness-adapter","super-adapter"]); | |
| for (const name of ["pi","hermes","opencode"]) allowed.add(name+"-token-budget-harness-adapter"); | |
| const releases=models.filter(m=>m.id.startsWith("idoru/Inkling-2-Mini-") && allowed.has(m.id.slice("idoru/Inkling-2-Mini-".length))); | |
| const links=releases.map(m=>{ | |
| const p=element("p"); | |
| p.append(linkTo(m.id.split("/")[1],"https://huggingface.co/"+m.id)); | |
| return p; | |
| }); | |
| document.getElementById("model-links").replaceChildren(...links); | |
| document.getElementById("models").hidden=!links.length; | |
| lastIndex=now; | |
| } | |
| let confirmed=new Set(); | |
| if (availableFiles.has("confirmed/index.json")) { | |
| try {confirmed=new Set((await publicJSON(source+"confirmed/index.json?t="+Math.floor(now/15000))).files);} catch {} | |
| } | |
| const resultURL=k=>source+(confirmed.has(k)?"confirmed/":"")+k; | |
| const scores=[...new Set([...availableFiles,...confirmed])].filter(k=>/^scores-[a-z0-9.-]+\.json$/.test(k)).sort(); | |
| const rows=await Promise.all(scores.map(async k=>{ | |
| const d=await publicJSON(resultURL(k)+"?t="+Math.floor(now/15000)); | |
| const suite={"terminal-bench-2.1":"Terminal-Bench 2.1","swe-pro-hard51":"SWE-bench Pro Hard-51"}[d.benchmark]; | |
| if (!suite || !Number.isInteger(d.graded)) return element("p"); | |
| const protocol={"native-128k-none":"128K, thinking off","native-128k-xhigh":"128K, xhigh reasoning"}[d.protocol] || "65K preliminary run"; | |
| const p=element("p"); | |
| const policy=d.policy==="native-check"?"one-update Pi pilot":d.policy.replace(/-step-(\d+)$/," specialist, step $1"); | |
| p.append(linkTo(suite+" · "+d.harness+" · "+policy,resultURL(k)), | |
| document.createTextNode(" · "+protocol+" · "+d.solved+" solved / "+d.graded+" graded · "+d.manifest_tasks+" tasks in the manifest")); | |
| const tokens=d.efficiency_on_graded?.generated_tokens; | |
| if (tokens?.tasks) p.append(element("span",Math.round(tokens.mean).toLocaleString("en-US")+ | |
| " generated tokens per task across "+tokens.tasks+" graded tasks with measured usage","metrics")); | |
| const paired=k.replace(/^scores-/,"paired-"); | |
| if (confirmed.has(paired) || availableFiles.has(paired)) { | |
| p.append(document.createTextNode(" · "),linkTo("Paired comparison",resultURL(paired))); | |
| const match=await publicJSON(resultURL(paired)+"?t="+Math.floor(now/15000)); | |
| if (match.scorable_pairs) { | |
| const n=match.scorable_pairs; | |
| p.append(element("span","Inkling on "+n+" scorable pairs · base "+Math.round(n*match.base_pass_at_1)+" solved · adapted "+Math.round(n*match.adapted_pass_at_1)+" solved","metrics")); | |
| const jointly=match.joint_efficiency||{}; | |
| for (const [key,title] of [["tool_calls","Tool calls"],["model_calls","Model calls"],["generated_tokens","Generated tokens"]]) { | |
| const metric=jointly[key]; | |
| if (metric?.tasks) p.append(element("span",title+" on "+metric.tasks+" jointly solved tasks · base "+metric.base_total.toLocaleString("en-US")+" · adapted "+metric.adapted_total.toLocaleString("en-US"),"metrics")); | |
| } | |
| const trainedFor=d.policy==="native-check"?"pi":d.policy.split("-step-")[0].replace(/-token-budget$/,""); | |
| if (qwenReference && (trainedFor===d.harness || d.policy==="super")) { | |
| const prefix=d.benchmark+"/"+d.harness+"/"; | |
| const effort=d.protocol.endsWith("xhigh")?"xhigh":"none"; | |
| const qbase=qwenReference.runs[prefix+"base/"+effort]?.tasks; | |
| const qtrained=qwenReference.runs[prefix+(d.policy==="super"?"final-half":"specialist")+"/"+effort]?.tasks; | |
| const excluded=new Set(match.unscorable); | |
| const common=d.results.map(r=>r.task).filter(t=>!excluded.has(t) && qbase?.[t]?.correctness!=null && qtrained?.[t]?.correctness!=null); | |
| if (common.length) { | |
| const sum=rows=>common.reduce((result,t)=>result+rows[t].correctness,0); | |
| p.append(element("span","Published Qwen on "+common.length+" shared pairs · base "+sum(qbase)+" solved · "+(d.policy==="super"?"merged adapter":"final specialist")+" "+sum(qtrained)+" solved","metrics")); | |
| } | |
| } | |
| } | |
| } | |
| return p; | |
| })); | |
| for (const file of [...availableFiles].filter(k=>/^automationbench-(base|pi|hermes|opencode|super)\.json$/.test(k)).sort()) { | |
| const d=await publicJSON(source+file+"?t="+Math.floor(now/15000)); | |
| if (!d.graded) continue; | |
| const p=element("p"); | |
| p.append(linkTo("AutomationBench · "+d.policy,source+file), | |
| document.createTextNode(" · "+d.solved+" solved / "+d.graded+" graded · "+d.manifest_tasks+" business workflows"), | |
| element("span",(100*d.mean_partial_credit).toFixed(1)+"% mean partial credit · "+d.assertions_passed+" / "+d.assertions_total+" assertions passed","metrics")); | |
| rows.push(p); | |
| } | |
| document.getElementById("score-rows").replaceChildren(...rows); | |
| document.getElementById("scoreboard").hidden=!rows.length; | |
| return true; | |
| } catch {return false;} | |
| } | |
| async function refreshHardware() { | |
| try { | |
| const res=await fetch(source+"live-hardware.json?t="+Math.floor(Date.now()/15000),{credentials:"omit",cache:"no-store",signal:AbortSignal.timeout(8000)}); | |
| if (res.status===404) return true; | |
| if (!res.ok) throw Error(res.status); | |
| const d=await res.json(); | |
| hardwareSnapshot=d; | |
| const list=document.createDocumentFragment(); | |
| for (const job of d.jobs) { | |
| const p=element("p"); | |
| const name=job.suite ? job.suite+" · "+job.harness+" · "+job.policy : (stages.find(([id])=>id===job.stage)?.[1] || job.stage); | |
| const link=element("a",name); | |
| if (!/^[a-f0-9]{24}$/.test(job.job)) continue; | |
| link.href="https://huggingface.co/jobs/idoru/"+job.job; | |
| const m=job.metrics; | |
| const facts=[job.hardware,job.state.toLowerCase()]; | |
| if (Number.isFinite(m.gpu_utilization_percent)) facts.push(m.gpu_utilization_percent+"% GPU utilization"); | |
| if (Number.isFinite(m.tokens_per_second)) facts.push("latest engine sample "+m.tokens_per_second+" output tokens/s",m.model_requests+" active model requests on that engine"); | |
| if (Number.isFinite(m.engine_rolling_prefix_hit_percent)) facts.push(m.engine_rolling_prefix_hit_percent+"% rolling prefix-cache hits on the reporting engine"); | |
| p.append(link,document.createTextNode(" · "+facts.join(" · "))); | |
| list.append(p); | |
| } | |
| document.getElementById("hardware-jobs").replaceChildren(list); | |
| document.getElementById("hardware-time").textContent="Measured "+utc(d.as_of)+" · "+d.active_cpu_sandboxes+" active task sandboxes"; | |
| const funding=await publicJSON("funding.json?t="+Math.floor(Date.now()/15000)); | |
| const costs=["$"+d.closed_job_usd_upper.toFixed(2)+" estimated for closed jobs","up to $"+d.active_reservations_usd.toFixed(2)+" reserved for active jobs"]; | |
| if (Number.isFinite(d.hf_metered_usd)) costs.unshift("$"+d.hf_metered_usd.toFixed(2)+" metered by Hugging Face across "+d.hf_metered_jobs+" project jobs"); | |
| if (Number.isFinite(d.elapsed_compute_usd_upper)) costs.push("up to $"+d.elapsed_compute_usd_upper.toFixed(2)+" in elapsed compute across all jobs"); | |
| costs.push("$"+funding.cumulative_review_usd+" cumulative spending review"); | |
| document.getElementById("funding").textContent=costs.join(" · "); | |
| document.getElementById("activity").hidden=false; | |
| return true; | |
| } catch {return false;} | |
| } | |
| update(); | |