Add dev/: training and export scripts, GPAI rule tests, browser tests, workspace map
28e3615 verified Download dev/browser-tests/tok.mjs from Devseis/Caveat: direct link, hf CLI and curl.
- Browser
- Download file 700 Bytes
-
https://huggingface.co/spaces/Devseis/Caveat/resolve/main/dev/browser-tests/tok.mjs
- Command line
-
hf download hf://spaces/Devseis/Caveat/dev/browser-tests/tok.mjs
-
curl -L -o tok.mjs https://huggingface.co/spaces/Devseis/Caveat/resolve/main/dev/browser-tests/tok.mjs
700 Bytes
| import { AutoTokenizer, AutoModelForSequenceClassification, env } from "@huggingface/transformers"; | |
| import fs from "fs"; | |
| env.allowLocalModels = true; env.allowRemoteModels = false; env.localModelPath = "./models/"; | |
| const tok = await AutoTokenizer.from_pretrained("eu-ai-act-classifier-v5"); | |
| const model = await AutoModelForSequenceClassification.from_pretrained("eu-ai-act-classifier-v5", { dtype: "q8" }); | |
| const texts = JSON.parse(fs.readFileSync("probe.json")); | |
| const out = []; | |
| for (const t of texts) { const e = tok(t); const o = await model(e); out.push({ ids: Array.from(e.input_ids.data, Number), logits: Array.from(o.logits.data) }); } | |
| fs.writeFileSync("probe_out.json", JSON.stringify(out)); | |