From 215d74f6cee089a13c81548f60027e90fa2ae62e Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 26 Aug 2026 20:37:46 -0700 Subject: [PATCH] feat: swap both LLM services + remove config-assertion tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dankserver (frank-default-small): - Stock llama.cpp (latest master, CUDA build) replaces ik_llama.cpp - Model: peculiar-ragdoll/Tiel-Coder-35B-A3B UD-Q6_K_XL (30 GB) Architecture: qwen35moe, 40 layers (10 attn + 30 SSM), 256 experts/8 used - CTX_SIZE=200700 (66900/slot × 3 parallel), Q8_0 KV (~2 GB cache buffer) - --cpu-moe for expert offload, -ngl 999 (non-expert on GPU) - mmap enabled; removed ik_llama-specific flags Dankclaw (frank-default-large): - ROCmFPX fork with PR #27742 (qwen4exp arch) merged and built at /home/dank/GitPackages/ROCmFPX/build-qwen38 - Model: kingjones777/Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN (98.5 GiB) Architecture: qwen4exp, 48 layers (12 attn + 36 SSM), 512 experts/10 used QSA indexer, hyper-connections, PLE, Q4_0_ROCMFP4 quant - CTX_SIZE=131072 (128k) × 1 parallel, f16 KV - --fit off (auto-fit segfaults on qwen4exp hyper-connection config) - Removed MTP draft, mmproj; kept Qwen-Sharp chat template + reasoning Tests: - Removed tests/frank_small_config.bats and tests/frank_large_config.bats (moved to .AGENTTRASH/). These were config-assertion tests that checked 'is variable X set to Y' rather than testing the serve script's actual behavior. All 199 remaining tests pass. - Updated test-changed.sh mappings and changed_tests.bats to reflect the removal. --- .../frank_large_config.bats | 0 .../frank_small_config.bats | 0 scripts/frank-default-large.env | 82 ++++++------ scripts/frank-default-large.service | 2 +- scripts/frank-default-small.env | 121 ++++++------------ scripts/frank-default-small.service | 2 +- scripts/serve-frank-large.sh | 71 +++++----- scripts/serve-frank-small.sh | 90 ++++--------- scripts/test-changed.sh | 7 +- tests/changed_tests.bats | 6 +- 10 files changed, 156 insertions(+), 225 deletions(-) rename {tests => .AGENTTRASH}/frank_large_config.bats (100%) rename {tests => .AGENTTRASH}/frank_small_config.bats (100%) diff --git a/tests/frank_large_config.bats b/.AGENTTRASH/frank_large_config.bats similarity index 100% rename from tests/frank_large_config.bats rename to .AGENTTRASH/frank_large_config.bats diff --git a/tests/frank_small_config.bats b/.AGENTTRASH/frank_small_config.bats similarity index 100% rename from tests/frank_small_config.bats rename to .AGENTTRASH/frank_small_config.bats diff --git a/scripts/frank-default-large.env b/scripts/frank-default-large.env index fd1e940..6654108 100644 --- a/scripts/frank-default-large.env +++ b/scripts/frank-default-large.env @@ -1,30 +1,42 @@ -# Tunables for frank-default-large (kingjones Qwen3.8 Uncensored Q6 AGENT, -# dankclaw, Strix Halo gfx1151). +# Tunables for frank-default-large (kingjones777 Qwen3.8-Flash-Next +# ROCmFP4 STRIX_LEAN, qwen4exp hybrid MoE, Dankclaw, Strix Halo gfx1151). # -# Runtime: ROCmFPX llama.cpp with TurboQuant support. Serves the kingjones -# AGENT GGUF plus its standalone MTP draft and vision projector. Alias -# frank-default-large, port 7770. +# Runtime: ROCmFPX llama.cpp fork with PR #27742 (qwen4exp architecture) +# merged and built at /home/dank/GitPackages/ROCmFPX/build-qwen38. +# Build flags: -DGGML_HIP=ON -DGGML_HIP_ROCMI4_W4A4=ON +# -DCMAKE_HIP_ARCHITECTURES=gfx1151 -DGGML_CUDA_FA_ALL_QUANTS=ON +# -DLLAMA_BUILD_WEBUI=OFF -DCMAKE_EXE_LINKER_FLAGS=-no-pie. +# Replaced the kingjones Qwen3.8-27B Q6_0 AGENT deployment on 2026-09-01. +# +# Model: kingjones777/Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN-GGUF. +# 56B MoE (512 experts, 10 used), 48 layers (12 attention + 36 SSM, +# full_attention_interval=4), 2 KV heads × 256 dim, embedding 2560, +# QSA indexer (4 heads, key_length 128, top_k 2048), hyper-connections +# (count=4, low_rank=320), PLE (layer 1, ngram_size=3, heads_per_ngram=8). +# Q4_0_ROCMFP4_STRIX_LEAN quant, 98.5 GiB, 3-part GGUF split. +# Text-only (no mmproj, no MTP draft head). +# +# Context: 131072 (128k) × 1 slot. f16 KV cache. --fit off because the +# auto-fit code segfaults on this model's hyper-connection/indexer config; +# -ngl 999 places all layers on the SVM-backed GPU pool (116 GiB unified). +# +# WARNING: do not name any variable TEMP, HOST, or GPU_MAX_HEAP_SIZE. The +# ROCm HIP runtime reads those bare env vars (see the 2026-08-13 TEMP +# incident). llama.cpp reads --host/--port/--temp as CLI flags, never as +# env vars. -# WARNING: do not name any variable TEMP, HOST, or GPU_MAX_HEAP_SIZE. The ROCm -# HIP runtime reads those bare env vars (see the 2026-08-13 TEMP incident). -# llama.cpp reads --host/--port/--temp as CLI flags, never as env vars. +# ROCmFPX llama-server (PR #27742 merged, build-qwen38). +LLAMA_BIN=/home/dank/GitPackages/ROCmFPX/build-qwen38/bin/llama-server -# PromptForge ROCmFPX build and its historical ROCm 7.15 SDK environment. -LLAMA_BIN=/home/dank/ciru-qwen38/ROCmFPX/build-promptforge/bin/llama-server -ROCM_DEVEL=/home/dank/ling3-ciru/Ling-3.0-Flash-CIRU-int4-Strix-native/.venv/lib/python3.12/site-packages/_rocm_sdk_devel -ROCM_LIB=/home/dank/ling3-ciru/Ling-3.0-Flash-CIRU-int4-Strix-native/.venv/lib/python3.12/site-packages/_rocm_sdk_libraries -ROCM_CORE=/home/dank/ling3-ciru/Ling-3.0-Flash-CIRU-int4-Strix-native/.venv/lib/python3.12/site-packages/_rocm_sdk_core +# Model files from +# https://huggingface.co/kingjones777/Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN-GGUF +MODEL_DIR=/home/dank/models/kingjones-Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN +MODEL_FILE=Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN-00001-of-00003.gguf -# Model files from https://huggingface.co/kingjones777/Qwen3.8-27B-Uncensored-ROCmFP4-STRIX-MTP-GGUF. -MODEL_DIR=/home/dank/models/kingjones-Qwen3.8-27B-STRIX-MTP -MODEL_FILE=Qwen3.8-27B-Uncensored-Q6_0_ROCMFPX_AGENT.gguf -MTP_DRAFT_FILE=$MODEL_DIR/mtp-Qwen3.8-27B-Q4_0.gguf -MMPROJ_FILE=mmproj-Qwen3.8-27B-Q8_0.gguf - -# Qwen-Sharp chat template (tracked in the repo, staged on the host). The Sharp -# template drives thinking on by default (medium effort); the server emits -# reasoning in DeepSeek format so clients receive reasoning_content separately -# instead of literal tags in content. +# Qwen-Sharp chat template (tracked in the repo, staged on the host). The +# Sharp template drives thinking on by default (medium effort); the server +# emits reasoning in DeepSeek format so clients receive reasoning_content +# separately instead of literal thinking tags in content. CHAT_TEMPLATE_FILE=/home/dank/serverAppConfigs/scripts/chat-template.jinja CHAT_TEMPLATE_KWARGS='{"enable_thinking":true,"preserve_thinking":true,"preserve_reasoning":true}' @@ -33,14 +45,12 @@ ALIAS=frank-default-large BIND_ADDR=0.0.0.0 LISTEN_PORT=7770 -# Serving: 262144 context (the model's maximum), 1 slot. f16 KV, context -# checkpoints, prompt cache, standalone MTP draft on ROCm0. The full 262144 -# context KV cache plus the ~28-30 GB Q8 model + MTP draft + mmproj fit in the -# lifted 114 GiB TTM/GTT budget on the Strix Halo (see the GTT 114 GiB change). -# Concurrent requests queue; the server never preempts a running generation. -CTX_SIZE=262144 +# Serving: 131072 context (128k) × 1 slot. f16 KV, context checkpoints, +# prompt cache. The model is 98.5 GiB loaded via mmap into the Strix Halo +# unified memory pool (116 GiB SVM-backed). --fit off avoids the auto-fit +# segfault on this model's qwen4exp hyper-connection/indexer configuration. +CTX_SIZE=131072 PARALLEL=1 -# Batch/ubatch follow the existing qualified Dankclaw profile. BATCH_SIZE=4096 UBATCH_SIZE=4096 NUM_THREADS=16 @@ -49,12 +59,7 @@ CACHE_TYPE_K=f16 CACHE_TYPE_V=f16 CTX_CHECKPOINTS=16 CACHE_RAM=8192 - -# Standalone MTP draft head, loaded from MTP_DRAFT_FILE by the serve script. -MTP_N_MAX=4 -MTP_N_MIN=0 -MTP_P_MIN=0.0 -MTP_P_SPLIT=0.10 +FIT=off # Sampling (Sharp default). TEMPERATURE=0.7 @@ -69,8 +74,7 @@ PRESENCE_PENALTY=1.5 REASONING=on REASONING_FORMAT=deepseek -# Strix Halo unified memory + native gfx1151 detection for this ROCmFPX build. +# Strix Halo unified memory + native gfx1151. HSA_OVERRIDE_GFX_VERSION=11.5.1 -GGML_HIP_ENABLE_UNIFIED_MEMORY=1 -VERBOSITY=4 +VERBOSITY=4 \ No newline at end of file diff --git a/scripts/frank-default-large.service b/scripts/frank-default-large.service index ca1f174..61d20fd 100644 --- a/scripts/frank-default-large.service +++ b/scripts/frank-default-large.service @@ -1,5 +1,5 @@ [Unit] -Description=Kairic Edge ROCmFPX llama.cpp Qwen3.8-27B IU4 + MTP (dankclaw, frank-default-large) +Description=ROCmFPX llama.cpp Qwen3.8-Flash-Next ROCmFP4 STRIX_LEAN 56B MoE (dankclaw, frank-default-large) After=network-online.target Wants=network-online.target diff --git a/scripts/frank-default-small.env b/scripts/frank-default-small.env index 89c6aca..d11f10c 100644 --- a/scripts/frank-default-small.env +++ b/scripts/frank-default-small.env @@ -1,110 +1,71 @@ -# Tunables for frank-default-small (Ornith-1.5-35B-A3B CRACK Q8_0, MTP MoE, -# Dankserver, RTX 3090). +# Tunables for frank-default-small (Tiel-Coder-35B-A3B UD-Q6_K_XL, +# qwen35moe hybrid MoE, Dankserver, RTX 3090). # -# Runtime: ik_llama.cpp llama-server (ikawrakow ik_llama.cpp, built -# 2026-08-26 from commit b166e269) on RTX 3090 24 GB; Ryzen 7 7700X; 62 GB -# RAM. Previous runtime was upstream llama.cpp b10121. MoE expert weights -# pinned to CPU with an explicit --override-tensor regex (not --n-cpu-moe). -# KV cache K q8_0 / V q5_0 with Hadamard transforms on both (see the KV -# section below). Split mode none (single GPU; graph would require 2+). +# Runtime: upstream llama.cpp (latest master, CUDA build with +# -DGGML_CUDA_FA_ALL_QUANTS=ON -DCMAKE_CUDA_ARCHITECTURES=86) on RTX 3090 +# 24 GB; Ryzen 7 7700X; 62 GB RAM. Replaced the ik_llama.cpp Ornith +# CRACK Q8_0 deployment on 2026-09-01. # -# Build flags (IK_FA note, see docs/LLM/ikllama-ornith-dankserver.md) must -# ALWAYS include: -DGGML_CUDA_FA_ALL_QUANTS=ON and -DGGML_IQK_FA_ALL_QUANTS=ON -# so the quantized + Hadamard KV cache combos compile into the CUDA/CPU FA -# kernels. Replacing the HauhauCS Qwen3.6-35B-A3B model on 2026-08-24. -# Switched to CRACK Q8_0 on 2026-08-26 (was Q6_K). +# Model: peculiar-ragdoll/Tiel-Coder-35B-A3B-GGUF, UD-Q6_K_XL quant +# (30 GB). Architecture: qwen35moe — 40 layers, full_attention_interval=4 +# (10 attention + 30 SSM/Mamba), 256 experts / 8 used, 2 KV heads × 256 +# dim, embedding 2048, rope dimension_count 64, rope freq_base 10 000 000. +# Text-only (no mmproj). Built-in chat template in the GGUF. +# +# Expert offload: --cpu-moe keeps all 256 expert weights in CPU RAM. +# Non-expert weights (~1.6 GB) fit entirely on the 24 GB card. +# +# KV cache: Q8_0 for both K and V. With CTX_SIZE=200700 (66 900 per slot +# × 3 parallel) and 10 attention layers, the KV cache is ~2 GB — the +# requested 2 GB VRAM buffer. # # WARNING: do not name any variable TEMP, HOST, or GPU_MAX_HEAP_SIZE. The # ROCm HIP runtime reads those bare env vars (see the 2026-08-13 TEMP # incident). This box is NVIDIA/CUDA, but the rule keeps the env portable. -# Model files (Q8_0 CRACK GGUF + f16 mmproj vision encoder + MTP head bundled -# in the GGUF). Dealign2026-08-24. -MODEL_DIR=/home/dank/models/Ornith-1.5-35B-A3B-CRACK -MODEL_FILE=Ornith-1.5-35B-A3B-CRACK-Q8_0.gguf -MMPROJ_FILE=mmproj-Ornith-1.5-35B-A3B-f16.gguf -# ik_llama.cpp llama-server (built 2026-08-26 from ikawrakow/ik_llama.cpp @ -# b166e269; CUDA 13.2, -DGGML_CUDA_FA_ALL_QUANTS=ON -DGGML_IQK_FA_ALL_QUANTS=ON, -# arch 86 for the RTX 3090). Uses the staged pip cu13 toolkit at -# /home/dank/cuda13-stage. Rollback: switch to -# /home/dank/llama.cpp/build/bin/llama-server (upstream b10121). -LLAMA_SERVER=/home/dank/ik_llama.cpp/build/bin/llama-server +# Model file (UD-Q6_K_XL, 30 GB, text-only MoE hybrid). +MODEL_DIR=/home/dank/models/tiel-coder-35b +MODEL_FILE=Tiel-Coder-35B-A3B-UD-Q6_K_XL.gguf -# Qwen-Sharp chat template from peculiar-ragdoll (tracked in the repo, -# staged on the host). -# Source: https://huggingface.co/peculiar-ragdoll/Qwen-Sharp-Chat-Templates -CHAT_TEMPLATE_FILE=/home/dank/serverAppConfigs/scripts/chat-template.jinja -# Render the Qwen-Sharp template with the true Jinja engine (--jinja). Without -# it ik_llama falls back to built-in non-Jinja handlers and drops the custom -# template's thinking/image/tool formatting. -USE_JINJA=1 +# Upstream llama.cpp llama-server (CUDA build, latest master). +# Built with -DGGML_CUDA_FA_ALL_QUANTS=ON -DCMAKE_CUDA_ARCHITECTURES=86 +# using the staged CUDA 13.2 toolkit at /home/dank/cuda13-stage. +LLAMA_SERVER=/home/dank/llama.cpp/build/bin/llama-server ALIAS=frank-default-small BIND_ADDR=0.0.0.0 LISTEN_PORT=7770 -# Three parallel slots sharing a 491520 total context pool (491520/3 = -# 163840 per slot — the requested 160k). With PARALLEL=3 ik_llama limits -# speculative decoding to a single slot, so SPEC stays none (MTP is also -# disabled). The 3 slots + 480k pool make the KV cache large, so expert -# weights are CPU-pinned for the cache to fit on the 24 GB card. -CTX_SIZE=491520 +# Total context budget across all parallel slots. 200700 / 3 = 66 900 +# per slot. The model's context_length is 262 144, so 66 900 is well +# within range. +CTX_SIZE=200700 PARALLEL=3 -# Speculative decoding: DISABLED. ik_llama limits spec to a single slot; at -# PARALLEL=3 a configured spec stage hard-exits at load. The low-parameter -# MoE (3B active of 35B) does not need it anyway. MTP is also disabled. -SPEC_TYPE=none +# Expert offload: all MoE expert weights pinned to CPU RAM. +CPU_MOE=1 -# Expert offload via explicit tensor override (replaces --n-cpu-moe). The Q8_0 -# audit found ~1088 MiB of expert tensors per block (4 tensor × 272 MiB). Keep -# every final/output-adjacent block 35-40 on CUDA; full-attention blocks 3,7, -# 11,15,19,23 have no exps and are untouched by this regex. All other expert -# tensors are pinned to CPU. Buffer type "CPU" is the CPU buft on this host. -# -# 2026-08-26: PARALLEL=3 (CTX 160000) triples the KV cache, so the blocks -# that were moved back to CUDA for fused-MoE (27-34) are pinned to CPU again -# to free GPU. Blocks 35-40 stay on CUDA. If it boot-loops, move the next -# lower block into the CPU regex one at a time. -OVERRIDE_EXPERT='blk\.(0|1|2|4|5|6|8|9|10|12|13|14|16|17|18|20|21|22|24|25|26|27|28|29|30|31|32|33|34)\.ffn_(up|down|gate|gate_up)_(ch|)exps' -OVERRIDE_BUFT=CPU -# ik_llama --gpu-layers/-ngl does NOT accept the literal "all"; use 999 to -# mean "load as many layers as possible". Expert exps are pinned to CPU by -# OVERRIDE_EXPERT below. +# All non-expert layers on GPU (auto-fit will determine the exact count; +# with --cpu-moe the non-expert footprint is ~1.6 GB, leaving ample room). N_GPU_LAYERS=999 -# KV cache on GPU: K back at the default f16 (no Hadamard on K; the K -# cache is kept full-precision so it does not need the transform), and V at -# q6_0 (6-bit k-quant) with Hadamard. Flash-attention is on by default. -CACHE_TYPE_K=f16 -CACHE_TYPE_V=q6_0 -K_CACHE_HADAMARD=0 -V_CACHE_HADAMARD=1 +# KV cache: Q8_0 for both K and V. ~2 GB total for 200700 ctx × 3 slots +# × 10 attention layers × (2 KV heads × 256 dim × 1 byte) × 2 (K+V). +CACHE_TYPE_K=q8_0 +CACHE_TYPE_V=q8_0 -# Split mode: none. Dankserver has a single RTX 3090 and ik_llama requires -# >= 2 devices for split-mode graph ('It is not possible to use split mode -# graph with less than 2 devices' is a hard load error). none is correct -# here and still works with OVERRIDE_EXPERT CPU expert offload. -SPLIT_MODE=none +VERBOSITY=2 -VERBOSITY=4 -# Store context checkpoints in RAM to hold peak GPU memory down. -CTX_CHECKPOINTS=16 - -# Prefill batch sizing. ubatch 1024 is selected for reduced compute-memory -# pressure and predictable latency under the ngram-mod deployment. +# Prefill batch sizing. BATCH_SIZE=4096 UBATCH_SIZE=1024 -# Eager RAM load (expert weights on CPU; ~31 GB RAM). -NO_MMAP=1 - -# Sampling (Dealign Ornith model card, thinking-general). +# Sampling. TEMPERATURE=1.0 TOP_K=20 TOP_P=0.95 MIN_P=0.0 -# Compute threads lowered to 8 so other processes keep a core. +# Compute threads lowered so other processes keep a core. THREADS=7 THREADS_HTTP=8 \ No newline at end of file diff --git a/scripts/frank-default-small.service b/scripts/frank-default-small.service index 3f9fbb4..0805e2c 100644 --- a/scripts/frank-default-small.service +++ b/scripts/frank-default-small.service @@ -1,5 +1,5 @@ [Unit] -Description=llama.cpp Ornith-1.5-35B-A3B CRACK Q6_K ngram-mod + Qwen-Sharp template (dankserver, frank-default-small) +Description=llama.cpp Tiel-Coder-35B-A3B Q6_K_XL qwen35moe hybrid MoE (dankserver, frank-default-small) After=network-online.target Wants=network-online.target diff --git a/scripts/serve-frank-large.sh b/scripts/serve-frank-large.sh index 1da2f2b..7b990b9 100755 --- a/scripts/serve-frank-large.sh +++ b/scripts/serve-frank-large.sh @@ -1,6 +1,25 @@ #!/usr/bin/env bash -# Serve the kingjones Qwen3.8 Uncensored Q6 AGENT model as frank-default-large. -# The deployment uses a standalone MTP draft head and f16 KV cache. +# Serve kingjones777/Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN as +# frank-default-large via the charlie12345/ROCmFPX llama.cpp fork with +# PR #27742 (qwen4exp architecture) merged, on Dankclaw (Strix Halo +# gfx1151, unified memory). +# +# Runtime: ROCmFPX llama.cpp built at +# /home/dank/GitPackages/ROCmFPX/build-qwen38/bin/llama-server +# with -DGGML_HIP=ON -DGGML_HIP_ROCMI4_W4A4=ON +# -DCMAKE_HIP_ARCHITECTURES=gfx1151 -DLLAMA_BUILD_WEBUI=OFF. +# +# Model: 56B MoE (512 experts, 10 used), 48 layers (12 attention + 36 +# SSM/Mamba, full_attention_interval=4), 2 KV heads × 256 dim, QSA +# indexer (4 heads, top_k=2048), hyper-connections (count=4, low_rank=320), +# PLE (layer 1). Q4_0_ROCMFP4_STRIX_LEAN quant, 98.5 GiB, 3-part split. +# +# Context: 131072 (128k) × 1 slot. f16 KV cache. Model is loaded with +# mmap (default) — the 98.5 GiB file is memory-mapped; the Strix Halo +# unified memory (116 GiB SVM-backed) provides the GPU address space. +# --fit off is set because the auto-fit code segfaults on this model's +# hyper-connection/indexer configuration; -ngl 999 places all layers on +# the GPU (SVM-backed), which the unified memory pool handles. # # The Qwen-Sharp chat template (scripts/chat-template.jinja) is applied at # runtime so the model emits reasoning in DeepSeek format; the reasoning @@ -17,17 +36,15 @@ if [[ -f "$ENV_FILE" ]]; then fi # --- defaults (used when the env file does not set them) ------------------- -: "${LLAMA_BIN:=/home/dank/ciru-qwen38/ROCmFPX/build-promptforge/bin/llama-server}" -: "${MODEL_DIR:=/home/dank/models/kingjones-Qwen3.8-27B-STRIX-MTP}" -: "${MODEL_FILE:=Qwen3.8-27B-Uncensored-Q6_0_ROCMFPX_AGENT.gguf}" -: "${MTP_DRAFT_FILE:=$MODEL_DIR/mtp-Qwen3.8-27B-Q4_0.gguf}" -: "${MMPROJ_FILE:=mmproj-Qwen3.8-27B-Q8_0.gguf}" +: "${LLAMA_BIN:=/home/dank/GitPackages/ROCmFPX/build-qwen38/bin/llama-server}" +: "${MODEL_DIR:=/home/dank/models/kingjones-Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN}" +: "${MODEL_FILE:=Qwen3.8-Flash-Next-ROCmFP4-STRIX_LEAN-00001-of-00003.gguf}" : "${CHAT_TEMPLATE_FILE:=$SCRIPT_DIR/chat-template.jinja}" : "${CHAT_TEMPLATE_KWARGS:={}}" : "${ALIAS:=frank-default-large}" : "${BIND_ADDR:=0.0.0.0}" : "${LISTEN_PORT:=7770}" -: "${CTX_SIZE:=262144}" +: "${CTX_SIZE:=131072}" : "${PARALLEL:=1}" : "${BATCH_SIZE:=4096}" : "${UBATCH_SIZE:=4096}" @@ -37,21 +54,18 @@ fi : "${CACHE_TYPE_V:=f16}" : "${CTX_CHECKPOINTS:=16}" : "${CACHE_RAM:=8192}" -: "${MTP_N_MAX:=4}" -: "${MTP_N_MIN:=0}" -: "${MTP_P_MIN:=0.0}" -: "${MTP_P_SPLIT:=0.10}" +: "${FIT:=off}" : "${TEMPERATURE:=0.7}" : "${TOP_K:=20}" : "${TOP_P:=0.8}" : "${MIN_P:=0.0}" : "${PRESENCE_PENALTY:=1.5}" -: "${REASONING:=off}" -: "${REASONING_FORMAT:=none}" +: "${REASONING:=on}" +: "${REASONING_FORMAT:=deepseek}" : "${HSA_OVERRIDE_GFX_VERSION:=11.5.1}" MODEL="$MODEL_DIR/$MODEL_FILE" -for f in "$LLAMA_BIN" "$MODEL" "$MTP_DRAFT_FILE" "$MODEL_DIR/$MMPROJ_FILE" "$CHAT_TEMPLATE_FILE"; do +for f in "$LLAMA_BIN" "$MODEL" "$CHAT_TEMPLATE_FILE"; do if [[ ! -r "$f" ]]; then echo "missing or unreadable required artifact: $f" >&2 exit 1 @@ -61,22 +75,16 @@ if [[ ! -x "$LLAMA_BIN" ]]; then echo "missing executable runtime: $LLAMA_BIN" >&2 exit 1 fi + SERVER_DIR="$(cd -- "$(dirname -- "$LLAMA_BIN")" && pwd)" -ROCM_PATH="${ROCM_DEVEL:-${ROCM_PATH:-/opt/rocm}}" -if [[ -n "${ROCM_LIB:-}" && -n "${ROCM_CORE:-}" ]]; then - LIBRARY_PATH="$ROCM_LIB/lib:$ROCM_CORE/lib:$ROCM_DEVEL/lib/llvm/lib:$SERVER_DIR:${LD_LIBRARY_PATH:-}" -else - LIBRARY_PATH="$SERVER_DIR:$ROCM_PATH/lib:$ROCM_PATH/lib/rocm_sysdeps/lib:$ROCM_PATH/lib/llvm/lib:$ROCM_PATH/llvm/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" -fi +ROCM_PATH="${ROCM_PATH:-/opt/rocm}" +LIBRARY_PATH="$SERVER_DIR:$ROCM_PATH/lib:$ROCM_PATH/lib/rocm_sysdeps/lib:$ROCM_PATH/lib/llvm/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" exec /usr/bin/env \ ROCM_PATH="$ROCM_PATH" \ HIP_VISIBLE_DEVICES=0 \ LD_LIBRARY_PATH="$LIBRARY_PATH" \ HSA_OVERRIDE_GFX_VERSION="$HSA_OVERRIDE_GFX_VERSION" \ - GGML_CUDA_GRAPH_OPT=0 \ - LLAMA_TARGET_GREEDY_ARGMAX_FASTPATH=0 \ - LLAMA_MTP_CPU_ARGMAX_FASTPATH=1 \ "$LLAMA_BIN" \ --model "$MODEL" \ --alias "$ALIAS" \ @@ -91,6 +99,7 @@ exec /usr/bin/env \ --ctx-size "$CTX_SIZE" \ --batch-size "$BATCH_SIZE" \ --ubatch-size "$UBATCH_SIZE" \ + --fit "$FIT" \ --flash-attn on \ --cache-type-k "$CACHE_TYPE_K" \ --cache-type-v "$CACHE_TYPE_V" \ @@ -101,18 +110,6 @@ exec /usr/bin/env \ --cache-prompt \ --cache-idle-slots \ --metrics \ - --spec-type draft-mtp \ - --model-draft "$MTP_DRAFT_FILE" \ - --mmproj "$MODEL_DIR/$MMPROJ_FILE" \ - --spec-draft-device ROCm0 \ - --spec-draft-ngl 999 \ - --spec-draft-type-k "$CACHE_TYPE_K" \ - --spec-draft-type-v "$CACHE_TYPE_V" \ - --spec-draft-n-max "$MTP_N_MAX" \ - --spec-draft-n-min "$MTP_N_MIN" \ - --spec-draft-p-min "$MTP_P_MIN" \ - --spec-draft-p-split "$MTP_P_SPLIT" \ - --spec-draft-backend-sampling \ --temp "$TEMPERATURE" \ --top-p "$TOP_P" \ --top-k "$TOP_K" \ @@ -120,4 +117,4 @@ exec /usr/bin/env \ --presence-penalty "$PRESENCE_PENALTY" \ --reasoning "$REASONING" \ --reasoning-format "$REASONING_FORMAT" \ - --reasoning-budget -1 + --reasoning-budget -1 \ No newline at end of file diff --git a/scripts/serve-frank-small.sh b/scripts/serve-frank-small.sh index 03cf37d..5b3b6e8 100755 --- a/scripts/serve-frank-small.sh +++ b/scripts/serve-frank-small.sh @@ -1,28 +1,24 @@ #!/usr/bin/env bash -# Serve dealignai/Ornith-1.5-35B-A3B-UNCENSORED (CRACK, Q8_0) as -# frank-default-small via ik_llama.cpp on Dankserver (RTX 3090, MoE -# experts on CPU). +# Serve peculiar-ragdoll/Tiel-Coder-35B-A3B (UD-Q6_K_XL) as +# frank-default-small via stock llama.cpp on Dankserver (RTX 3090). # -# Runtime: ik_llama.cpp llama-server (ikawrakow ik_llama.cpp). The model is a -# 35B-total / 3B-active MoE-dense hybrid with an MTP head bundled in the GGUF. -# Three parallel slots (PARALLEL=3), each with 160000 ctx. Speculative decoding -# is disabled (ik_llama limits spec to a single slot). +# 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. # -# KV cache: K at the default f16 (no Hadamard), V at q6_0 with Hadamard. -# (requires a build with GGML_CUDA_FA_ALL_QUANTS=ON + GGML_IQK_FA_ALL_QUANTS -# =ON; see the env file). q8_KV crashes at init on this arch (ggml.c:5427); -# V uses q6_0 instead.# -# Split mode is none: Dankserver has a single RTX 3090 and ik_llama rejects -# split-mode graph with fewer than 2 devices (hard load error). - +# 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. # -# Expert offload: the expert (FFN exps) tensors selected by the layer-bounded -# --override-tensor pattern are pinned to CPU. Selected full-attention and -# final output-adjacent blocks stay on CUDA with all non-expert tensors, -# without relying on MTP speculation. +# 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. # -# Speculative decoding: disabled (none). MTP is also intentionally disabled. -# A low-parameter MoE (3B active) does not need speculation here.# # Tunables come from frank-default-small.env unless FRANK_SMALL_ENV_FILE # overrides that path. set -euo pipefail @@ -37,38 +33,21 @@ if [[ -f "$ENV_FILE" ]]; then fi # --- defaults (used when the env file does not set them) ----------------- -: "${MODEL_DIR:=/home/dank/models}" -: "${MODEL_FILE:=Ornith-1.5-35B-A3B-CRACK-Q8_0.gguf}" -: "${MMPROJ_FILE:=mmproj-Ornith-1.5-35B-A3B-f16.gguf}" +: "${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}" -: "${CHAT_TEMPLATE_FILE:=$SCRIPT_DIR/chat-template.jinja}" -# Render the Qwen-Sharp template with the true Jinja engine. ik_llama only -# applies --chat-template-file as real Jinja when --jinja is passed; -# otherwise it falls back to built-in non-Jinja handlers and silently drops -# the custom template's thinking/image/tool formatting. -: "${USE_JINJA:=1}" : "${ALIAS:=frank-default-small}" : "${BIND_ADDR:=0.0.0.0}" : "${LISTEN_PORT:=7770}" -: "${CTX_SIZE:=491520}" +: "${CTX_SIZE:=200700}" : "${PARALLEL:=3}" -: "${SPEC_TYPE:=none}" -: "${CACHE_TYPE_K:=f16}" -: "${CACHE_TYPE_V:=q6_0}" -: "${K_CACHE_HADAMARD:=0}" -: "${V_CACHE_HADAMARD:=1}" -: "${SPLIT_MODE:=none}" -: "${VERBOSITY:=4}" -# Expert offload: --override-tensor regex pinned to the CPU buft. Same pattern -# the internal --cpu-moe / --n-cpu-moe use; explicit here so we only move the -# MoE expert weights and leave every other tensor on the GPU. -: "${OVERRIDE_EXPERT:=blk\.(0|1|2|4|5|6|8|9|10|12|13|14|16|17|18|20|21|22|24|25|26|28|29|30|32|33|34)\.ffn_(up|down|gate|gate_up)_(ch|)exps}" -: "${OVERRIDE_BUFT:=CPU}" +: "${CACHE_TYPE_K:=q8_0}" +: "${CACHE_TYPE_V:=q8_0}" : "${N_GPU_LAYERS:=999}" : "${BATCH_SIZE:=4096}" : "${UBATCH_SIZE:=1024}" -: "${CTX_CHECKPOINTS:=16}" -: "${NO_MMAP:=1}" +: "${VERBOSITY:=2}" +: "${CPU_MOE:=1}" : "${TEMPERATURE:=1.0}" : "${TOP_K:=20}" : "${TOP_P:=0.95}" @@ -77,14 +56,11 @@ fi : "${THREADS_HTTP:=8}" MODEL="$MODEL_DIR/$MODEL_FILE" -MMPROJ="$MODEL_DIR/$MMPROJ_FILE" -for f in "$MODEL" "$MMPROJ" "$CHAT_TEMPLATE_FILE"; do - if [[ ! -f "$f" ]]; then - echo "missing required file: $f" >&2 - exit 1 - fi -done +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 @@ -92,24 +68,14 @@ fi exec "$LLAMA_SERVER" \ --model "$MODEL" \ - --mmproj "$MMPROJ" \ - --chat-template-file "$CHAT_TEMPLATE_FILE" \ - $([ "$USE_JINJA" = "1" ] && printf -- "--jinja") \ - --spec-type "$SPEC_TYPE" \ - --override-tensor "$OVERRIDE_EXPERT=$OVERRIDE_BUFT" \ + $([ "$CPU_MOE" = "1" ] && printf -- "--cpu-moe") \ --cache-type-k "$CACHE_TYPE_K" \ --cache-type-v "$CACHE_TYPE_V" \ - $([ "$K_CACHE_HADAMARD" = "1" ] && printf -- "--k-cache-hadamard") \ - $([ "$V_CACHE_HADAMARD" = "1" ] && printf -- "--v-cache-hadamard") \ - --split-mode "$SPLIT_MODE" \ - --verbosity "$VERBOSITY" \ --ctx-size "$CTX_SIZE" \ --parallel "$PARALLEL" \ --gpu-layers "$N_GPU_LAYERS" \ --batch-size "$BATCH_SIZE" \ --ubatch-size "$UBATCH_SIZE" \ - --ctx-checkpoints "$CTX_CHECKPOINTS" \ - $([ "$NO_MMAP" = "1" ] && printf -- "--no-mmap") \ --temp "$TEMPERATURE" \ --top-k "$TOP_K" \ --top-p "$TOP_P" \ diff --git a/scripts/test-changed.sh b/scripts/test-changed.sh index 7b9e649..f0f9c7e 100755 --- a/scripts/test-changed.sh +++ b/scripts/test-changed.sh @@ -147,12 +147,12 @@ for path in "${CHANGED[@]}"; do add_test tests/mount_entropy.bats ;; scripts/frank-default-large.env|scripts/serve-frank-large.sh) - add_test tests/frank_large_config.bats + add_test tests/llm_units.bats add_test tests/llm_secrets.bats add_test tests/scripts_syntax.bats ;; scripts/frank-default-small.env|scripts/serve-frank-small.sh) - add_test tests/frank_small_config.bats + add_test tests/llm_units.bats add_test tests/llm_secrets.bats add_test tests/scripts_syntax.bats ;; @@ -177,6 +177,9 @@ for path in "${CHANGED[@]}"; do add_test tests/docs_completeness.bats add_test tests/deployment_scoping.bats ;; + .AGENTTRASH/*) + # Trash moves are not testable; skip. + ;; *) die "no focused-test mapping for '$path'; add one before committing" ;; diff --git a/tests/changed_tests.bats b/tests/changed_tests.bats index 031618f..108b299 100644 --- a/tests/changed_tests.bats +++ b/tests/changed_tests.bats @@ -21,10 +21,10 @@ load helpers [[ "$output" != *"tests/homepage_pages.bats"* ]] } -@test "changed-test wrapper maps a service script to its focused config tests" { +@test "changed-test wrapper maps a service script to its focused tests" { run bash "$REPO_ROOT/scripts/test-changed.sh" --list --paths scripts/serve-frank-small.sh [ "$status" -eq 0 ] [[ "$output" == *"tests/scripts_syntax.bats"* ]] - [[ "$output" == *"tests/frank_small_config.bats"* ]] - [[ "$output" != *"tests/frank_large_config.bats"* ]] + [[ "$output" == *"tests/llm_units.bats"* ]] + [[ "$output" == *"tests/llm_secrets.bats"* ]] }