Skip to content

Commit

Permalink
Merge branch 'main' into fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dluc authored Feb 1, 2024
2 parents ac1fb07 + b396029 commit 5e71206
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions jsctrl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@ fixed token output, regexps, LR(1) grammars, substring constrains etc.
JavaScript code is typically only used lightly, for gluing the primitives together,
and thus is not performance critical.

There are [some sample scripts](ts/) available.
The scripts use the [aici module](ts/aici.ts) to communicate with the AICI runtime
There are [some sample scripts](./samples/) available.
The scripts use the [aici module](./samples/aici-types.d.ts) to communicate with the AICI runtime
and use the native constraints.

This is quite similar to [pyctrl](../pyctrl/README.md) but with JavaScript instead of Python.
This is quite similar to [PyCtrl](../pyctrl/README.md) but with JavaScript instead of Python.
It is also smaller, at 1.3MiB without regex and CFG, 1.8MiB with regex, and 3.3MiB with regex and CFG.
For comparison, pyctrl is 14MiB.
Also, the [PyCtrl samples](../pyctrl/samples/) translate 1:1 to JsCtrl.

## Usage

To run a JsCtrl sample (using controller tagged with `jsctrl-latest`) use:

```bash
../aici.sh run ts/sample.js
../aici.sh run samples/hello.js
```

If you write your sample in TypeScript, compile it first with `tsc -p ts`.
If you write your sample in TypeScript, compile it first with `tsc -p samples`.

If you want to build the interpreter yourself, use:

```bash
../aici.sh run --build . ts/sample.js
../aici.sh run --build . samples/hello.js
```

You will see the console output of the program.
Expand Down
2 changes: 1 addition & 1 deletion scripts/host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if [ "$INNER" = "model" ] ; then
PREF="cd $FOLDER && CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"
ARGS="--port $FWD_PORT --shm-prefix /aici-${MODEL}-"
if [ "$CPP" -eq 1 ] ; then
docker_cmd "$PREF /workspaces/aici/rllm-cpp/cpp-server.sh --loop --cuda $MODEL $ARGS"
docker_cmd "$PREF /workspaces/aici/rllm-cpp/cpp-server.sh --loop --cuda $MODEL $ARGS --gpu-layers 1000"
else
docker_cmd "$PREF /workspaces/aici/rllm-cuda/server.sh --loop $MODEL $ARGS"
fi
Expand Down

0 comments on commit 5e71206

Please sign in to comment.