Download test.js from sapbot/cowqa: direct link, hf CLI and curl.
- Browser
- Download file 590 Bytes
-
https://huggingface.co/datasets/sapbot/cowqa/resolve/main/test.js
- Command line
-
hf download hf://datasets/sapbot/cowqa/test.js
-
curl -L -o test.js https://huggingface.co/datasets/sapbot/cowqa/resolve/main/test.js
590 Bytes
| const ask = require("ask-my-llm").ask | |
| const dataset = JSON.parse(require("fs").readFileSync("dataset.json")) | |
| let correct = 0 | |
| dataset.forEach((i) => { | |
| console.log(i.question) | |
| let predicted = ask(`${i.question} | |
| A. ${i.A} | |
| B. ${i.B} | |
| C. ${i.C} | |
| Return ONLY letter. Nothing more.`).trim() | |
| console.log(`Expected: ${i.correct} (${i[i.correct]}) Predicted: ${predicted} (${i[predicted] || "Not choice!"})`) | |
| if (i.correct == predicted) { | |
| correct++ | |
| } | |
| }) | |
| console.log(`Final score: ${correct}/${dataset.length} (${Math.round((correct / dataset.length) * 100 * 100) / 100})%`) |