adaptai / platform /aiml /mlops /docs /ELIZABETH_VAST_DEPLOYMENT.md
ADAPT-Chase's picture
Add files using upload-large-folder tool
93be2a2 verified
|
raw
history blame
5.2 kB

Elizabeth on Vast.ai — Architecture, Status, and Next Steps

Why (Rationale)

  • Local serving for latency, privacy, and control (no managed endpoint dependency).
  • Repeatable, fast launches via container images and Vast templates.
  • Clear separation of concerns: serving (vLLM), training (accelerate/deepspeed), and observability.
  • Reproducibility: pinned Docker tags + pinned model revisions (HF or Volume).

High‑Level Architecture

  • Serve (inference):
    • vLLM on GPU; OpenAI API on :8000; API key required.
    • SSH + Jupyter for interactive ops; can be disabled in hardened prod.
    • Uses local model path (prefer Vast Volume) or HF pull on first boot.
  • Train (finetune/resume):
    • Dedicated container (accelerate/deepspeed/bitsandbytes).
    • Writes checkpoints to a separate path; never overwrites serving weights.
    • Promotion flow to update serving safely.
  • State/logs:
    • Sessions: DragonFly/Redis (fast) + Postgres (durable).
    • Logs/DB snapshots consolidated under /data/adaptai/projects/elizabeth (cron ready).

Images & Bases

  • Base for “-vast” line: vastai/pytorch:@vastai-automatic-tag (CUDA 12.6; SSH/Jupyter/portal included).
  • Serve image (planned): elizabeth-serve-vast — adds vLLM + CLIs; starts SSH/Jupyter/vLLM.
  • Train image (planned): elizabeth-train-vast — adds training stack + CLIs; starts SSH/Jupyter.
  • CUDA images (existing): elizabeth-serve, elizabeth-train (CUDA 12.6, SSH/Jupyter added).

Data Layout

  • Canonical: /data/{models,ckpts,logs,cache}.
  • Symlinks: /workspace/{models,ckpts,logs,cache} -> /data/{…}.
  • MODEL_PATH default: /data/models/qwen3-8b-elizabeth-sft.

Secrets & Auth

  • Vast User Env Vars: HF_TOKEN, GITHUB_TOKEN, VAST_API_KEY, DOCKERHUB_TOKEN.
  • Entry auto‑auths CLIs if tokens set; no secrets in images.
  • vLLM API uses a bearer key; HF pull only if explicitly enabled.

Model Source Strategy

  • Short term: HF pull (pinned revision) into instance disk.
  • Medium/long: Vast Volume seeded with weights → mount into serving container (WAN‑free restarts).

CI/CD

  • GitHub Actions builds/pushes images to Docker Hub (adaptchase) and GHCR (adaptnova).
  • Matrix builds (serve/train); tags: latest, short SHA, optional release.
  • Build time tracking: add run Summary + CSV artifact (TODO below).

Vast Templates

  • Serve template: image elizabeth-serve(-vast):latest; ports 22/8888/8000; portal links vLLM.
  • Train template: image elizabeth-train(-vast):latest; ports 22/8888; MODEL_PATH/OUTPUT_DIR envs.

Promotion Flow

  1. Train → checkpoint under /data/ckpts/elizabeth/checkpoint-XXXX.
  2. Validate → promote into /data/models/qwen3-8b-elizabeth-sft (or use scripts/promote_checkpoint.sh).
  3. Restart serving → verify /health + sample completion.
  4. Optional: publish promoted checkpoint to HF.

Logging & Auditing

  • Logs centralized: /data/adaptai/projects/elizabeth/logs (indexed).
  • DB consolidation: inventory + archive DB under /data/adaptai/projects/elizabeth/state.
  • Optional Redis snapshots (eliz:* → JSONL).

Security

  • vLLM API key; SSH/Jupyter tokens mandatory on public IPs.
  • No secrets in images; env only; consider IP allowlists.

DR

  • HF repo with pinned revisions; Docker tags/SHAs enable rollbacks.
  • Optional S3/GCS for large optimizer states.

What’s Done

  • Local vLLM serving on canonical path; curl tests OK.
  • Session logging: Redis/DragonFly + Postgres (CLI + orchestrator wired).
  • Logs/DB consolidation + cron wrapper.
  • CUDA 12.6 images for serve/train published; SSH working; Jupyter when mapped.
  • CI to Docker Hub + GHCR; Vast templates created; base flow validated.

In‑Flight

  • Bake “-vast” images FROM vastai/pytorch (serve/train): user x, CLIs, symlinks, SSH/Jupyter/vLLM.
  • CI build time tracking (run Summary + artifact).
  • New Vast templates referencing “-vast” images.
  • Launch on 4× H200 (DC 135125, machine 32376) for SSH/Jupyter/vLLM verification.

Next (Near‑Term TODOs)

  • Complete build & push of elizabeth-serve-vast / elizabeth-train-vast.
  • Register new Vast templates; record IDs.
  • Launch on machine 32376; verify SSH/Jupyter(:8888)/vLLM(:8000)/portal.
  • Add CI step writing build durations (serve/train) to Summary; upload CSV artifact.
  • Decide HF pull vs Volume for prod nodes; seed Volume if chosen.
  • Harden prod templates (optional: disable SSH/Jupyter by default).
  • Document rollback (pinned tag + model revision).

Future (Mid‑Term)

  • Promotion guardrails (smoke evals) before swap.
  • Multi‑node scale‑out via templates + pinned tags.
  • Optional ClickHouse export from Postgres.
  • Derived images for hardware variants.
  • Syncthing for small artifacts only (not weights/checkpoints).

Runbooks (Quick)

  • Health: curl -sS http://:8000/health
  • Completion: curl -sS -H 'Authorization: Bearer ' -H 'Content-Type: application/json' -d '{"model":"qwen3-8b-elizabeth","prompt":"Hello","max_tokens":16}' http://:8000/v1/completions
  • Logs index: /data/adaptai/projects/elizabeth/logs/INDEX.md
  • DB inventory: /data/adaptai/projects/elizabeth/state/DB_INVENTORY.md
  • Maintenance: /data/adaptai/projects/elizabeth/maintenance.sh