#!/usr/bin/env bash # Serve peculiar-ragdoll/Tiel-Coder-35B-A3B (UD-Q6_K_XL) as # frank-default-small via stock llama.cpp on Dankserver (RTX 3090). # # Runtime: upstream llama.cpp (latest master, CUDA build with # -DGGML_CUDA_FA_ALL_QUANTS=ON -DCMAKE_CUDA_ARCHITECTURES=86). # The model is a 35B-total / 8-active MoE hybrid (qwen35moe arch) with # SSM/Mamba layers (full_attention_interval=4: 10 attention + 30 SSM # layers out of 40). 256 experts, 8 used per token. # # Expert offload: --cpu-moe keeps all 256 expert weights in CPU RAM. # Non-expert weights (attention, SSM, shared expert, embeddings, output) # are ~1.6 GB and fit entirely on the 24 GB RTX 3090. # # KV cache: Q8_0 for both K and V. With CTX_SIZE=200700 (66 900 per # slot × 3 parallel) and 10 attention layers (2 KV heads × 256 dim), # the KV cache is ~2 GB — the requested 2 GB VRAM buffer. # # Model is loaded with mmap (default). The 30 GB Q6_K_XL file is # memory-mapped; only accessed pages enter RAM. # # Tunables come from frank-default-small.env unless FRANK_SMALL_ENV_FILE # overrides that path. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ENV_FILE="${FRANK_SMALL_ENV_FILE:-$SCRIPT_DIR/frank-default-small.env}" if [[ -f "$ENV_FILE" ]]; then set -a # shellcheck disable=SC1090 source "$ENV_FILE" set +a fi # --- defaults (used when the env file does not set them) ----------------- : "${MODEL_DIR:=/home/dank/models/tiel-coder-35b}" : "${MODEL_FILE:=Tiel-Coder-35B-A3B-UD-Q6_K_XL.gguf}" : "${LLAMA_SERVER:=/home/dank/llama.cpp/build/bin/llama-server}" : "${ALIAS:=frank-default-small}" : "${BIND_ADDR:=0.0.0.0}" : "${LISTEN_PORT:=7770}" : "${CTX_SIZE:=200700}" : "${PARALLEL:=3}" : "${CACHE_TYPE_K:=q8_0}" : "${CACHE_TYPE_V:=q8_0}" : "${N_GPU_LAYERS:=999}" : "${BATCH_SIZE:=4096}" : "${UBATCH_SIZE:=1024}" : "${VERBOSITY:=2}" : "${CPU_MOE:=1}" : "${TEMPERATURE:=1.0}" : "${TOP_K:=20}" : "${TOP_P:=0.95}" : "${MIN_P:=0.0}" : "${THREADS:=7}" : "${THREADS_HTTP:=8}" MODEL="$MODEL_DIR/$MODEL_FILE" if [[ ! -f "$MODEL" ]]; then echo "missing required file: $MODEL" >&2 exit 1 fi if [[ ! -x "$LLAMA_SERVER" ]]; then echo "missing llama-server binary: $LLAMA_SERVER" >&2 exit 1 fi exec "$LLAMA_SERVER" \ --model "$MODEL" \ $([ "$CPU_MOE" = "1" ] && printf -- "--cpu-moe") \ --cache-type-k "$CACHE_TYPE_K" \ --cache-type-v "$CACHE_TYPE_V" \ --ctx-size "$CTX_SIZE" \ --parallel "$PARALLEL" \ --gpu-layers "$N_GPU_LAYERS" \ --batch-size "$BATCH_SIZE" \ --ubatch-size "$UBATCH_SIZE" \ --temp "$TEMPERATURE" \ --top-k "$TOP_K" \ --top-p "$TOP_P" \ --min-p "$MIN_P" \ --threads "$THREADS" \ --threads-http "$THREADS_HTTP" \ --alias "$ALIAS" \ --host "$BIND_ADDR" \ --port "$LISTEN_PORT"