plane-mode-scholar / scripts /space_entrypoint.sh
PMS Sync
Deploy 000b308 (flattened for HF Spaces)
4577459
Raw
History Blame Contribute Delete
1.49 kB
#!/usr/bin/env bash
# Hugging Face Docker Space entrypoint — embedded llama.cpp (llama-cpp-python + CUDA).
set -euo pipefail
export PMS_INFERENCE_BACKEND="${PMS_INFERENCE_BACKEND:-llamacpp}"
export PMS_LLAMACPP_MODE="${PMS_LLAMACPP_MODE:-embedded}"
export PMS_USE_FINETUNED="${PMS_USE_FINETUNED:-true}"
export PMS_FINETUNED_MODEL="${PMS_FINETUNED_MODEL:-GuusBouwensNL/plane-mode-nemotron-4b-study-coach}"
export PMS_LORA_GGUF_MODEL="${PMS_LORA_GGUF_MODEL:-GuusBouwensNL/plane-mode-study-coach-lora-gguf}"
export PMS_LLAMACPP_N_GPU_LAYERS="${PMS_LLAMACPP_N_GPU_LAYERS:--1}"
export PMS_GGUF_DIR="${PMS_GGUF_DIR:-/data/models/nemotron}"
export PMS_LLAMACPP_MODEL_DIR="${PMS_LLAMACPP_MODEL_DIR:-$PMS_GGUF_DIR}"
mkdir -p "$PMS_GGUF_DIR"
# Optional: map HF preload cache blobs into expected paths (hf_hub_download also uses cache).
if [[ -z "${PMS_LLAMACPP_MODEL:-}" ]]; then
for candidate in \
"$PMS_GGUF_DIR/NVIDIA-Nemotron3-Nano-4B-Q4_K_M.gguf" \
/data/NVIDIA-Nemotron3-Nano-4B-Q4_K_M.gguf \
/data/*.gguf; do
if [[ -f "$candidate" ]] && [[ "$candidate" != *lora* ]]; then
export PMS_LLAMACPP_MODEL="$candidate"
break
fi
done
fi
if [[ -z "${PMS_LLAMACPP_LORA:-}" ]]; then
for candidate in \
"$PMS_GGUF_DIR/plane-mode-study-coach-lora.gguf" \
/data/plane-mode-study-coach-lora.gguf \
/data/*lora*.gguf; do
if [[ -f "$candidate" ]]; then
export PMS_LLAMACPP_LORA="$candidate"
break
fi
done
fi
exec python3 /app/app.py