Download engine/serve.sh from RightNowAI/RightNow-Mini: direct link, hf CLI and curl.
- Browser
- Download file 2.58 kB
-
https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/engine/serve.sh
- Command line
-
hf download hf://RightNowAI/RightNow-Mini/engine/serve.sh
-
curl -L -o serve.sh https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/engine/serve.sh
2.58 kB
| # RightNow Mini's engine: one command, an OpenAI-compatible server on one GPU. | |
| # | |
| # MODEL_DIR=/path/to/model DRAFTER_DIR=/path/to/Inkling-2-Mini-DFlash2 bash engine/serve.sh | |
| # | |
| # What it is: vLLM (the image below, pinned by digest) with speculative decoding through a prepared copy of the | |
| # published draft model `incoai/Inkling-2-Mini-DFlash2` (see engine/build_drafter.py for what is prepared and why). | |
| # The model checks every drafted token. Measured speed and the token-by-token comparison with the stock engine are | |
| # in results/speed.md. | |
| # | |
| # Variables: GPU (0), PORT (8000), HOST (127.0.0.1), NAME (rightnow-mini), SERVED (rightnow-mini), DRAFT=0 for no drafting. | |
| set -eu | |
| MODEL_DIR=${MODEL_DIR:?the folder with the model weights} | |
| GPU=${GPU:-0}; PORT=${PORT:-8000}; HOST=${HOST:-127.0.0.1}; NAME=${NAME:-rightnow-mini}; SERVED=${SERVED:-rightnow-mini} | |
| IMAGE=${IMAGE:-vllm/vllm-openai@sha256:3f80650e404965216b36042caca709598d4163342366d86c4247a06541eca81d} | |
| DOCKER=${DOCKER:-docker} | |
| HERE=$(cd "$(dirname "$0")" && pwd) | |
| ARGS=(--model /model --served-model-name "$SERVED" --tensor-parallel-size 1 --reasoning-parser inkling | |
| --enable-auto-tool-choice --tool-call-parser inkling --host "$HOST" --port "$PORT") | |
| MOUNTS=(-v "$MODEL_DIR":/model:ro) | |
| if [ "${DRAFT:-1}" = 1 ]; then | |
| DRAFTER_DIR=${DRAFTER_DIR:?the folder with incoai/Inkling-2-Mini-DFlash2 (or DRAFT=0)} | |
| PREPARED=${PREPARED:-$DRAFTER_DIR-prepared} | |
| if [ ! -s "$PREPARED/model.safetensors" ]; then | |
| mkdir -p "$PREPARED" | |
| $DOCKER run --rm --entrypoint python3 -v "$MODEL_DIR":/model:ro -v "$DRAFTER_DIR":/drafter:ro -v "$PREPARED":/prepared \ | |
| -v "$HERE":/engine:ro "$IMAGE" /engine/build_drafter.py /model /drafter /prepared | |
| fi | |
| MOUNTS+=(-v "$PREPARED":/drafter:ro) | |
| ARGS+=(--speculative-config '{"method":"dflash","model":"/drafter","num_speculative_tokens":7,"draft_sample_method":"probabilistic"}') | |
| fi | |
| $DOCKER rm -f "$NAME" >/dev/null 2>&1 || true | |
| $DOCKER run -d --name "$NAME" --gpus "device=$GPU" --ipc=host --network host "${MOUNTS[@]}" \ | |
| -e VLLM_NO_USAGE_STATS=1 -e DO_NOT_TRACK=1 "$IMAGE" "${ARGS[@]}" ${EXTRA:-} | |
| echo "starting $NAME on GPU $GPU, http://$HOST:$PORT/v1 (model id: $SERVED)" | |
| for i in $(seq 1 180); do | |
| if curl -s -m 3 "http://$HOST:$PORT/v1/models" | grep -q '"id"'; then echo "ready after $((i * 5)) s"; exit 0; fi | |
| if [ -z "$($DOCKER ps -q -f name="^$NAME$")" ]; then echo "the server exited:"; $DOCKER logs --tail 30 "$NAME" 2>&1 | cut -c1-300; exit 1; fi | |
| sleep 5 | |
| done | |
| echo "not ready after 900 s"; exit 1 | |