Wire in GPU optimizations and Gitea↔GitHub sync
Ollama config (all 3 setup scripts): - Models updated from Qwen 2.5 → Qwen 3.5 series (Feb 2026) - Auto-detect multi-GPU: TOTAL_VRAM = per-card × count - KV cache quantization (q8_0) + flash attention enabled by default - Context windows scaled by total VRAM (4K→128K) - RAG server CHAT_MODEL now uses detected model variable Gitea↔GitHub sync (new): - gitea-github-sync.sh: bidirectional mirror with --init wizard - Modes: --pull-only, --push-only, --list (dry run), --repo single - Auto-discovers repos from both platforms via API - Systemd timer: --install-timer [interval] for scheduled sync - MCP tool: gitea_github_sync() for on-demand from Claude/WebUI - Sync script mounted read-only into mcp-server container - .env gets GITEA_URL variable for sync script - curl added to mcp-server container deps https://claude.ai/code/session_01PtYTPherSJaxDEVPgF6Nxu
This commit is contained in:
+26
-12
@@ -1106,19 +1106,31 @@ IS_UPDATE=false; [[ -f "$BASE/docker-compose.yml" ]] && IS_UPDATE=true
|
||||
# ── detect VRAM and set models accordingly ────────────────────────────────────
|
||||
VRAM_GB=$(nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits 2>/dev/null \
|
||||
| head -1 | awk '{printf "%d", $1/1024}' 2>/dev/null || echo "0")
|
||||
GPU_COUNT=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | wc -l || echo "0")
|
||||
TOTAL_VRAM=$((VRAM_GB * GPU_COUNT))
|
||||
|
||||
if [[ "$VRAM_GB" -ge 14 ]]; then
|
||||
CHAT_MODEL="qwen2.5:14b"; CODE_MODEL="qwen2.5-coder:14b"
|
||||
CTX=32768; TIER="16GB — 14B models + 32k context"
|
||||
elif [[ "$VRAM_GB" -ge 8 ]]; then
|
||||
CHAT_MODEL="qwen2.5:14b"; CODE_MODEL="qwen2.5-coder:7b"
|
||||
CTX=16384; TIER="8-16GB — 14B chat, 7B code, 16k context"
|
||||
elif [[ "$VRAM_GB" -ge 4 ]]; then
|
||||
CHAT_MODEL="qwen2.5:7b"; CODE_MODEL="qwen2.5-coder:7b"
|
||||
CTX=8192; TIER="6GB — 7B models, 8k context"
|
||||
# Ollama optimization flags (stacked — see docs/gpu-setup-research.md)
|
||||
OLLAMA_KV_CACHE="q8_0" # halves KV cache VRAM (q4_0 for aggressive)
|
||||
OLLAMA_FLASH="1" # flash attention: less VRAM, no quality loss
|
||||
|
||||
if [[ "$TOTAL_VRAM" -ge 40 ]]; then
|
||||
CHAT_MODEL="qwen3.5:27b"; CODE_MODEL="qwen3.5:27b"
|
||||
CTX=131072; TIER="${TOTAL_VRAM}GB — 27B dense, 128K context"
|
||||
elif [[ "$TOTAL_VRAM" -ge 28 ]]; then
|
||||
CHAT_MODEL="qwen3.5-35b-a3b"; CODE_MODEL="qwen3.5-35b-a3b"
|
||||
CTX=131072; TIER="${TOTAL_VRAM}GB — 35B MoE, 128K context"
|
||||
elif [[ "$TOTAL_VRAM" -ge 14 ]]; then
|
||||
CHAT_MODEL="qwen3.5-35b-a3b"; CODE_MODEL="qwen3.5-35b-a3b"
|
||||
CTX=65536; TIER="${TOTAL_VRAM}GB — 35B MoE + KV quant, 64K context"
|
||||
elif [[ "$TOTAL_VRAM" -ge 8 ]]; then
|
||||
CHAT_MODEL="qwen3.5:9b"; CODE_MODEL="qwen3.5:9b"
|
||||
CTX=32768; TIER="${TOTAL_VRAM}GB — 9B dense, 32K context"
|
||||
elif [[ "$TOTAL_VRAM" -ge 4 ]]; then
|
||||
CHAT_MODEL="qwen3.5:4b"; CODE_MODEL="qwen3.5:4b"
|
||||
CTX=16384; TIER="${TOTAL_VRAM}GB — 4B models, 16K context"
|
||||
else
|
||||
CHAT_MODEL="qwen2.5:7b"; CODE_MODEL="qwen2.5-coder:7b"
|
||||
CTX=4096; TIER="CPU-only — 7B models, 4k context"
|
||||
CHAT_MODEL="qwen3.5:4b"; CODE_MODEL="qwen3.5:4b"
|
||||
CTX=4096; OLLAMA_KV_CACHE="q4_0"; TIER="CPU-only — 4B models, 4K context"
|
||||
fi
|
||||
EMBED_MODEL="nomic-embed-text"
|
||||
|
||||
@@ -1611,9 +1623,11 @@ services:
|
||||
volumes: [ollama-models:/root/.ollama]
|
||||
environment:
|
||||
- OLLAMA_NUM_GPU=999
|
||||
- OLLAMA_NUM_CTX=
|
||||
- OLLAMA_NUM_CTX=$CTX
|
||||
- OLLAMA_KEEP_ALIVE=24h
|
||||
- OLLAMA_MAX_LOADED_MODELS=1
|
||||
- OLLAMA_KV_CACHE_TYPE=$OLLAMA_KV_CACHE
|
||||
- OLLAMA_FLASH_ATTENTION=$OLLAMA_FLASH
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
|
||||
Reference in New Issue
Block a user