File size: 1,164 Bytes
019a4b4
 
 
2ab66bf
 
019a4b4
2ab66bf
 
 
 
 
 
019a4b4
2ab66bf
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
set -e

# 1) Frontend up first so the page + description render immediately.
uvicorn app:app --host 0.0.0.0 --port "${PORT}" &

# 2) POCKET-26B backend (:8080) — Chat tab AND the POCKET side of the A/B.
#    Repo may be private, so the Space's HF_TOKEN secret authorizes the download.
echo "[start] downloading POCKET ${MODEL_FILE} …"
PK=$(python -c "import os;from huggingface_hub import hf_hub_download;print(hf_hub_download(os.environ['MODEL_REPO'],os.environ['MODEL_FILE'],token=os.environ.get('HF_TOKEN')))")
echo "[start] POCKET at ${PK}"
llama-server -m "${PK}" --host 127.0.0.1 --port 8080 -c "${N_CTX}" -t "$(nproc)" --no-webui &

# 3) Bonsai backend (:8081) — the Bonsai side of the A/B race. Same stock binary.
echo "[start] downloading Bonsai ${BONSAI_FILE} …"
BN=$(python -c "import os;from huggingface_hub import hf_hub_download;print(hf_hub_download(os.environ['BONSAI_REPO'],os.environ['BONSAI_FILE']))")
echo "[start] Bonsai at ${BN}"
# exec = keep container alive on this process; sequential A/B means no CPU contention.
exec llama-server -m "${BN}" --host 127.0.0.1 --port 8081 -c "${N_CTX}" -t "$(nproc)" --no-webui