Spaces:
Running
Running
Download build_artifacts.js from Hugdrigo/modelguard-observatory: direct link, hf CLI and curl.
- Browser
- Download file 2.21 kB
-
https://huggingface.co/spaces/Hugdrigo/modelguard-observatory/resolve/main/build_artifacts.js
- Command line
-
hf download hf://spaces/Hugdrigo/modelguard-observatory/build_artifacts.js
-
curl -L -o build_artifacts.js https://huggingface.co/spaces/Hugdrigo/modelguard-observatory/resolve/main/build_artifacts.js
2.21 kB
| // Rebuild reproducible prediction records using the original ModelOps v2 engine and dataset. | |
| const fs=require('node:fs'), crypto=require('node:crypto'), path=require('node:path'); | |
| const source=__dirname;const E=require('./source_modelops_engine.js'); | |
| const train=JSON.parse(fs.readFileSync(source+'/train.json','utf8')); | |
| const iid=JSON.parse(fs.readFileSync(source+'/iid_test.json','utf8')); | |
| const challenge=JSON.parse(fs.readFileSync(source+'/challenge.json','utf8')); | |
| const bundle=E.train(train), methods=['nb','word','char','hybrid']; | |
| let all=[]; | |
| for(const [split,rs] of [['iid',iid],['challenge',challenge]]){ | |
| const audit=E.audit(train,rs);if(!audit.clean)throw Error('dataset integrity failure '+split); | |
| for(const method of methods){const predictions=E.evaluate(bundle,rs,method);for(const p of predictions){all.push({split,method,id:p.id,language:p.language,domain:p.domain,truth:p.truth,pred:p.pred,tokenCount:E.features(p.text,'word').size,chars:p.text.length, text:p.text});}} | |
| } | |
| const result={schemaVersion:'1.0.0',source:'Academic Rhetorical Intent Mini v1.1',sourceType:'synthetic_curated',sourceProject:'ModelOps Research Lab v2.0',computed:'retrained deterministic baselines',warning:'These are synthetic-curated evaluation splits, NOT temporal production monitoring.',labels:E.LABELS,methods,rows:all}; | |
| fs.writeFileSync(__dirname+'/evaluation_snapshots.json',JSON.stringify(result)); | |
| const dataSha=crypto.createHash('sha256').update(fs.readFileSync(__dirname+'/evaluation_snapshots.json')).digest('hex'); | |
| const b={schemaVersion:'1.0',sourceProject:'ModelOps Research Lab v2.0',sourceDataset:'Academic Rhetorical Intent Mini v1.1',trainCount:train.length,iidCount:iid.length,challengeCount:challenge.length,predictionRows:all.length,methods:methods,labels:E.LABELS,sourceType:'synthetic_curated',evaluationSha256:dataSha,inputSha256:Object.fromEntries(['train.json','iid_test.json','challenge.json','source_modelops_engine.js'].map(n=>[n,crypto.createHash('sha256').update(fs.readFileSync(path.join(source,n))).digest('hex')])),generatedBy:'node build_artifacts.js'}; | |
| fs.writeFileSync(__dirname+'/benchmark_manifest.json',JSON.stringify(b,null,2)); | |
| console.log(JSON.stringify(b,null,2)); | |