tiny-hash-intent / predict_driver.mjs
WideChaos's picture
Publish Tiny Hash Intent with model and experiment records
a2bd61d verified
Raw History Blame Contribute Delete
605 Bytes
import fs from "node:fs";
import { parseModel, predict, features } from "./inference.mjs";
const model = parseModel(
fs.readFileSync(
new URL("./run-001/model-int8.json", import.meta.url),
"utf8",
),
);
const cases = JSON.parse(fs.readFileSync(0, "utf8"));
console.log(
JSON.stringify(
cases.map((input) => {
try {
return {
input,
features: features(input),
raw: predict(model, input, false),
calibrated: predict(model, input, true),
};
} catch (e) {
return { input, error: e.message };
}
}),
),
);