Files
ubuntu-bare-metal/stacks/vllm/scripts/switch-model.sh
T
tomasz-syn-grzegorza 359afb3a59 Initial import: bare-metal stacks, Server UI, GPU fan, tutorials.
Infrastructure configs for GMKtec K11 (Docker, vLLM, LocalAI, ComfyUI,
control-plane, gpu-fan agent, Server UI with CLI/file explorer/GPU fan curve).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 12:02:04 +00:00

74 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
STACK_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/catalog-lib.sh"
cd "${STACK_DIR}"
PROFILE="${1:-}"
if [[ -z "${PROFILE}" ]]; then
echo "Usage: $0 <profile-name>"
echo ""
echo "Profiles:"
ls -1 "${STACK_DIR}/profiles/"*.env 2>/dev/null | xargs -n1 basename | sed 's/\.env$//' | sed 's/^/ /'
exit 1
fi
PROFILE_FILE="${STACK_DIR}/profiles/${PROFILE}.env"
if [[ ! -f "${PROFILE_FILE}" ]]; then
echo "ERROR: Profile not found: ${PROFILE_FILE}"
echo ""
echo "Available profiles:"
ls -1 "${STACK_DIR}/profiles/"*.env 2>/dev/null | xargs -n1 basename | sed 's/\.env$//' | sed 's/^/ /'
exit 1
fi
if [[ -f .env ]]; then
set -a
# shellcheck disable=SC1091
source .env
set +a
fi
DATA_ROOT="${DATA_ROOT:-/data}"
catalog_ensure_dirs "${DATA_ROOT}"
echo "=== Switch vLLM profile: ${PROFILE} ==="
cp "${PROFILE_FILE}" .env
set -a
# shellcheck disable=SC1091
source .env
set +a
if [[ "${VLLM_MODEL:-}" == *".gguf"* ]]; then
echo "ERROR: VLLM_MODEL points to a .gguf file — vLLM does not support GGUF."
echo " Use stacks/llamacpp (future) or an AWQ Hugging Face model."
echo " See: ./scripts/list-models.sh"
exit 1
fi
if [[ -z "${VLLM_MODEL:-}" ]]; then
echo "ERROR: Profile has empty VLLM_MODEL"
exit 1
fi
echo "Model: ${VLLM_MODEL}"
echo "Served as: ${SERVED_MODEL_NAME:-qwen3.6-27b}"
echo "Context: ${MAX_MODEL_LEN:-131072}"
echo ""
if docker compose --profile vllm ps -q vllm 2>/dev/null | grep -q .; then
echo "Restarting vLLM container ..."
docker compose --profile vllm down
"${SCRIPT_DIR}/start.sh"
else
echo "vLLM not running. Start with:"
echo " ./scripts/start.sh"
fi