File size: 725 Bytes
73bd12f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import json
from pathlib import Path
from sealcell.model import get_model
model = get_model()
source = json.loads(Path("data/fixtures/playground-probes.json").read_text())
out = Path("reports/local-probes.jsonl")
with out.open("w") as f:
for case in source["cases"]:
result = model.classify(case["text"], source["schema"])
f.write(json.dumps({"fixture_id": case["id"], **result}) + "\n")
f.flush()
print(
case["id"],
result["error"] or {k: v["selected_label"] for k, v in result["heads"].items()},
round(result["total_ms"]),
flush=True,
)
Path("reports/model-metadata.json").write_text(json.dumps(model.metadata, indent=2) + "\n")
|