Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
| 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 | |