run.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # Mod: flashnext-int4-b12x
  3. # Lets eugr's vllm-node-b12x image serve azampatti/Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound across two GB10 nodes with
  4. # the b12x RoCE all-reduce (recipe: recipes/qwen3.8-flash-next-int4-b12x.yaml).
  5. #
  6. # The launcher copies this folder into EVERY node's container and runs run.sh before the launch script; a non-zero exit
  7. # aborts the launch, so a node with a missing or incomplete model never starts serving. Nothing outside the container is
  8. # written, the Hugging Face cache is read-only here, and nothing is copied: the two folders below are symlinks + small JSON.
  9. #
  10. # 1. check the model in the HF cache (what ~/Qwen3.8-Flash-Next-Int4-FAST/setup.sh downloads)
  11. # 2. build /workspace/flashnext/model (served model view: PLE table indexed, config fields b12x needs) build_views.py
  12. # /workspace/flashnext/draft-k10 (slim MTP draft folder, top-k 10, the head's own shared-expert width)
  13. # 3. patch this container's vLLM: fp8 hybrid, int4 lm_head, loader index filter (required); draft x2, GDN fixes (optional)
  14. # patch_b12x.py
  15. set -euo pipefail
  16. MOD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  17. REPO=/root/.cache/huggingface/hub/models--azampatti--Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound
  18. OUT=/workspace/flashnext
  19. die(){ echo "FATAL $(hostname): $*" >&2; exit 1; }
  20. [ -f "$REPO/refs/main" ] || die "model not in the HF cache -- run ./setup.sh in ~/Qwen3.8-Flash-Next-Int4-FAST on this node"
  21. REV=$(cat "$REPO/refs/main"); SNAP="$REPO/snapshots/$REV"
  22. [ -d "$SNAP/ple-table" ] || die "snapshot ${REV:0:8} has no ple-table -- run ./setup.sh in ~/Qwen3.8-Flash-Next-Int4-FAST on this node"
  23. for f in config.json model.safetensors.index.json model-healed-shared-expert.safetensors model_extra_tensors.safetensors \
  24. model-lmhead-int4.safetensors medium_chat_template.jinja; do
  25. [ -e "$SNAP/$f" ] || die "snapshot ${REV:0:8} is incomplete: $f is missing (download still running?)"
  26. done
  27. python3 -c "import b12x" 2>/dev/null || die "this is not the b12x image (no b12x package) -- the recipe needs vllm-node-b12x"
  28. mkdir -p "$OUT"
  29. VIEWS=$(python3 "$MOD_DIR/build_views.py" "$SNAP" "$OUT") || die "could not build the model folders"
  30. PATCH=$(python3 "$MOD_DIR/patch_b12x.py" "$MOD_DIR") || die "could not patch vLLM: $PATCH"
  31. echo "$(hostname): snapshot ${REV:0:8} | $VIEWS"
  32. echo "$(hostname): $PATCH"