Initial commit: router front-door vLLM stack

Three always-running vLLM services (text TP=2 GPU0+1, ocr + embed on GPU2,
sleep mode) behind a FastAPI router that auto-wakes models on request.
Tiered idle (sleep 15 min / offload 3 h), depth-aware 503s with
Retry-After, persisted wake-intent recovery, admin API on 127.0.0.1:8010.
Routine control via vllmctl is pure HTTP — no docker on the request path.

Verified: 91 router unit tests + 15-test E2E on real hardware
(measurements in CALIBRATION.md; design record in
.claude/memory/router-front-door-plan.md).

Old nginx stack files removed before git init; design survives in
.claude/memory/sleep-mode-implementation-plan.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-17 10:17:42 +00:00
commit 80eef4ce6a
35 changed files with 6506 additions and 0 deletions

43
diag/weight_check.py Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Verify every tensor of a safetensors model is finite (no NaN/Inf) and
sane. Usage: python3 weight_check.py /models/<MODEL_DIR>
Run inside the vllm container (it has torch + safetensors):
docker cp diag/weight_check.py vllm:/tmp/ && \
docker exec vllm python3 /tmp/weight_check.py /models/Qwen3.6-35B-A3B
"""
import glob
import os
import sys
import torch
from safetensors import safe_open
def main():
model_dir = sys.argv[1] if len(sys.argv) > 1 else "/models"
files = sorted(glob.glob(os.path.join(model_dir, "*.safetensors")))
if not files:
print(f"no safetensors found in {model_dir}")
return 2
total = bad = 0
for f in files:
with safe_open(f, framework="pt", device="cpu") as st:
for k in st.keys():
t = st.get_tensor(k)
total += 1
if torch.is_floating_point(t):
if not torch.isfinite(t).all():
print(f"BAD {os.path.basename(f)}::{k} "
f"nan={int(torch.isnan(t).sum())} inf={int(torch.isinf(t).sum())}",
flush=True)
bad += 1
elif t.dtype != torch.bool and (t.abs() > 1e6).any():
print(f"ODD {os.path.basename(f)}::{k} max={t.abs().max().item()}",
flush=True)
print(f"DONE shards={len(files)} tensors={total} bad={bad}")
return 1 if bad else 0
if __name__ == "__main__":
sys.exit(main())