Spaces:
Runtime error
Runtime error
| # One-shot setup for Well-Tuned + Llama Champion + Off the Grid badge stack. | |
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| cd "$ROOT" | |
| echo "==> 1/4 Export fine-tuned LoRA to GGUF" | |
| python3 scripts/export_lora_gguf.py | |
| echo "==> 2/4 Download Nemotron 4B base GGUF (skip if present)" | |
| GGUF_DIR="${PMS_GGUF_DIR:-${ROOT}/models/nemotron}" | |
| GGUF_FILE="${PMS_GGUF_FILE:-NVIDIA-Nemotron3-Nano-4B-Q4_K_M.gguf}" | |
| mkdir -p "$GGUF_DIR" | |
| if [[ ! -f "${GGUF_DIR}/${GGUF_FILE}" ]]; then | |
| python3 -c " | |
| from huggingface_hub import hf_hub_download | |
| hf_hub_download('nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF', '${GGUF_FILE}', local_dir='${GGUF_DIR}') | |
| " | |
| fi | |
| echo "==> 3/4 Build llama-server (skip if present)" | |
| VENDOR_BIN="${ROOT}/vendor/llama.cpp/build/bin/llama-server" | |
| if [[ ! -x "$VENDOR_BIN" ]]; then | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq build-essential g++ libstdc++-12-dev cmake git | |
| CC=gcc CXX=g++ cmake -S vendor/llama.cpp -B vendor/llama.cpp/build \ | |
| -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DBUILD_SHARED_LIBS=OFF | |
| cmake --build vendor/llama.cpp/build -j"$(nproc)" --target llama-server | |
| fi | |
| echo "==> Done. Start stack:" | |
| echo " Terminal 1: ./scripts/start_llamacpp.sh" | |
| echo " Terminal 2: PMS_INFERENCE_BACKEND=llamacpp python3 app.py" | |
| echo " Verify: curl -s localhost:7860/api/health | python3 -m json.tool" | |