# selene — AtlaAI Selene 1 Mini (Llama 3.1 8B) judge/eval model on ana-ml2 GPU 1.
#
# Restores the judge that went offline when llama-swap was downed (it was the
# Q6_K GGUF `selene-1-mini-8b` in the llama-swap zoo). Re-served on vLLM at the
# operator's request, FP8 (NVFP4 had no pre-made checkpoint and W4A4 is too
# aggressive for a precision judge validated at Q6_K — FP8 ≥ Q6_K fidelity).
#
# FP8 = vLLM DYNAMIC --quantization fp8 (W8A8) of the bf16 AtlaAI checkpoint —
# no offline quant needed, near-lossless, and Selene is text-only Llama 3.1 so
# there's NO vision tower for dynamic fp8 to noise-quantize (the qwen35-VL
# footgun doesn't apply here). ~8 GiB weights on GPU 1's headroom.
#
# Co-tenant on GPU 1 with qwen36 (NVFP4) + granite + embed/rerank/reward. Sized
# to fit the ~24 GB headroom while leaving GPU 1 a safe buffer (see .env).
# Served ONLY as `selene-1-mini-8b` (the name its consumers know). All tunables
# live in .env.

name: selene

services:
  vllm-selene:
    image: ${SELENE_IMAGE}
    container_name: ${SELENE_CONTAINER_NAME}
    restart: unless-stopped
    ipc: host
    ports:
      - "${SELENE_PORT}:8000"
    volumes:
      - /tank/aimodels/huggingface:/hfcache
    environment:
      - HF_HOME=/hfcache
      - HF_HUB_CACHE=/hfcache/hub
      - HUGGING_FACE_HUB_TOKEN=${HF_TOKEN:-}
      - VLLM_API_KEY=${API_KEY:-}
    command:
      - ${SELENE_MODEL}
      # Dynamic FP8 (W8A8) from the bf16 checkpoint — no pre-quant needed.
      - --quantization
      - fp8
      - --served-model-name
      - selene-1-mini-8b
      - --host
      - 0.0.0.0
      - --port
      - "8000"
      - --gpu-memory-utilization
      - ${SELENE_GPU_MEM_UTIL}
      - --max-model-len
      - ${SELENE_MAX_MODEL_LEN}
      - --max-num-seqs
      - ${SELENE_MAX_NUM_SEQS}
      # fp8 KV — matches the judge's old q8 KV posture + keeps the pool compact
      # on the shared card.
      - --kv-cache-dtype
      - fp8
      - --dtype
      - auto
      - --enable-prefix-caching
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              device_ids:
                - "${SELENE_GPU_ID}"
              capabilities:
                - gpu
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 180s
    networks:
      - tnet
    labels:
      - homepage.group=AI - Eval & Retrieval
      - homepage.name=Selene 1 Mini 8B (judge, FP8)
      - homepage.icon=mdi-gavel
      - homepage.description=AtlaAI Selene 1 Mini Llama-3.1-8B judge (FP8) via vLLM (ana-ml2 GPU1)
      - homepage.href=http://10.250.50.54:${SELENE_PORT}/docs

networks:
  tnet:
    name: traefik-net
    external: true
