diff --git a/controllers/jsctrl/samples/count-yellow.js b/controllers/jsctrl/samples/count-yellow.js new file mode 100644 index 00000000..c663c067 --- /dev/null +++ b/controllers/jsctrl/samples/count-yellow.js @@ -0,0 +1,43 @@ +import { Label, setLogLevel } from "aici" + +const colors = [ + // "red", + // "green", + "blue", + // "violet", + // "white", + // "black", +] + +function gencolors(k) { + let s = [] + + for (let i = 0; i < k; ++i) { + s.push(colors[Math.floor(Math.random() * colors.length)]) + } + + return s.join(", ") +} + +async function countYellow() { + setLogLevel(10) + const q = `Does the color yellow appear in the following list of colors?` + await $`<|user|>\n${q}\n` + const l = new Label() + for (let i = 0; i < 100; ++i) { + const hasYellow = Math.random() < 0.5 + const A = (10 + Math.random() * 100) | 0 + const B = (10 + Math.random() * 130) | 0 + const text = gencolors(A) + (hasYellow ? ", yellow, " : ", blue, ") + gencolors(B) + await l.fixedAfter(`${text}<|end|>\n<|assistant|>`) + const r = await gen({ maxTokens: 10, regex: /(Yes|No)/ }) + console.log(q) + console.log(text) + console.log(hasYellow ? "Yes" : "No", r) + assert(r === "Yes" || r === "No") + assert(r === (hasYellow ? "Yes" : "No")) + await $`\n` + } +} + +start(countYellow) diff --git a/controllers/jsctrl/samples/mapping.js b/controllers/jsctrl/samples/mapping.js new file mode 100644 index 00000000..0a6074b0 --- /dev/null +++ b/controllers/jsctrl/samples/mapping.js @@ -0,0 +1,33 @@ +import { Label, getTokens, setLogLevel } from "aici" + +function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min) +} + +async function countYellow() { + setLogLevel(0) + const q = `Tell me the value of x42?` + await $`<|user|>\n${q}\n` + const l = new Label() + let numok = 0 + for (let i = 0; i < 20; ++i) { + let text = "" + let x42 = randomInt(10, 99) + for (let i = 10; i < 300; ++i) { + text += `The value of x${i} is ${i == 42 ? x42 : randomInt(10, 99)}.\n` + } + await l.fixedAfter(`${text}\nTell me x42.<|end|>\n<|assistant|>The value of x42 is `) + const r = await gen({ maxTokens: 10, regex: /\d\d/ }) + // console.log(q) + // console.log(text) + console.log(getTokens().length, x42, r, r === x42.toString()) + if (r === x42.toString()) { + numok++ + } + // assert(r === x42.toString()) + await $`\n` + } + console.log("numok", numok) +} + +start(countYellow) diff --git a/py/vllm b/py/vllm index 0633e02e..47ecc58b 160000 --- a/py/vllm +++ b/py/vllm @@ -1 +1 @@ -Subproject commit 0633e02e7c633c4e5c81276b2a41dfe5a33fa699 +Subproject commit 47ecc58b7de40d624ba6cebe70839771babffd1c diff --git a/scripts/vllm-server.sh b/scripts/vllm-server.sh index 144e8ae5..f4d42bd0 100755 --- a/scripts/vllm-server.sh +++ b/scripts/vllm-server.sh @@ -5,6 +5,8 @@ set -x if [ -z "$FOLDER" ]; then MODEL_ARGS="--model microsoft/Orca-2-13b --revision refs/pr/22 --aici-tokenizer orca" + #MODEL_ARGS="--model microsoft/Phi-3-mini-128k-instruct --trust-remote-code" + #MODEL_ARGS="--model microsoft/Phi-3-mini-4k-instruct --trust-remote-code" else MODEL_ARGS="--model ./$FOLDER --aici-tokenizer ./$FOLDER/tokenizer.json --tokenizer ./$FOLDER" fi