Download web/scripts/evaluate-transitions.mjs from loveaa/OneAlign: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/spaces/loveaa/OneAlign/resolve/main/web/scripts/evaluate-transitions.mjs
- Command line
-
hf download hf://spaces/loveaa/OneAlign/web/scripts/evaluate-transitions.mjs
-
curl -L -o evaluate-transitions.mjs https://huggingface.co/spaces/loveaa/OneAlign/resolve/main/web/scripts/evaluate-transitions.mjs
1.96 kB
| // A controlled rule-only diagnostic. Reuse saved model answers without making new predictions. | |
| import fs from 'node:fs' | |
| import path from 'node:path' | |
| import {ContractEngine} from '../server/contract-engine.mjs' | |
| const out=path.resolve('../output/kimi-jev-evaluation-20261013') | |
| const results=[] | |
| for(const [id,source] of [['G19','runs-v1.2-dense'],['H02','runs-dense'],['H09','runs-dense']]){ | |
| const run=JSON.parse(fs.readFileSync(path.join(out,source,id+'.json'),'utf8')) | |
| const plan=structuredClone(JSON.parse(fs.readFileSync(path.join(out,run.planFile),'utf8')).plan) | |
| const changes=[] | |
| for(const rule of plan.rules){ | |
| const terms=[...rule.condition.terms,...(rule.then?.terms||[])] | |
| if(['occurrence','sequence'].includes(rule.mode)&&terms.every(t=>plan.observers.find(o=>o.id===t.observer)?.input==='pair')){ | |
| changes.push({rule:rule.id,before:rule.confirmation_frames,after:1}) | |
| rule.confirmation_frames=1 | |
| } | |
| } | |
| const engine=new ContractEngine(plan,{cameraId:run.clipId,sourceId:run.sourceId}) | |
| const base=Date.parse(run.baseTime)/1000 | |
| const signals=Object.fromEntries(run.simulatedSignals.map(k=>[k,{value:true,observedAt:base-1,validUntil:base+86400,source:'explicit_test_injection'}])) | |
| for(const o of run.observations)engine.observe({...o.trace,cameraId:run.clipId,sourceId:run.sourceId,quality:run.groundingPassed?'usable':'unregistered_target'},Object.fromEntries(o.predictions.map(p=>[p.observer,p.answer||{choice:null,abstained:true}])),{signals}) | |
| results.push({caseId:id,sourceRun:source+'/'+id+'.json',method:'Rule-only replay of the same saved two-image visual answers. A transition is counted once; the model is not rerun.',changes,beforeNotices:run.runtime.notices.length,afterNotices:engine.notices.length,notices:engine.notices,plan}) | |
| } | |
| fs.writeFileSync(path.join(out,'transition-confirmation-diagnostic.json'),JSON.stringify(results,null,2)) | |
| console.log(results.map(r=>({caseId:r.caseId,before:r.beforeNotices,after:r.afterNotices}))) | |