Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b92c2128dd | ||
|
|
c2b99e69ce | ||
|
|
ecd0809280 | ||
|
|
381733e0cf | ||
|
|
27c35b1ce1 | ||
|
|
b7afd84024 | ||
|
|
e7adec38f0 | ||
|
|
4f612601f6 | ||
|
|
a25b3e7a18 | ||
|
|
692dfc8a4b | ||
|
|
2ddb1c8199 | ||
|
|
53a8b45660 |
@@ -0,0 +1,19 @@
|
||||
enable_expert_parallel = true
|
||||
enable_eplb = false
|
||||
use_deep_gemm = true
|
||||
gpu_memory_utilization = 0.85
|
||||
|
||||
[model]
|
||||
name = "zai-org/GLM-5-FP8"
|
||||
tool_call_parser = "auto"
|
||||
reasoning_parser = "glm45"
|
||||
|
||||
[deployment]
|
||||
type = "disaggregated"
|
||||
num_prefill_nodes = 4
|
||||
num_decode_nodes = 2
|
||||
gpus_per_node = 8
|
||||
|
||||
[slurm]
|
||||
job_name = "glm5"
|
||||
partition = "cluster"
|
||||
@@ -0,0 +1,91 @@
|
||||
# Disaggregated Prefill/Decode Inference
|
||||
|
||||
Run MoE models with separate prefill and decode node groups for higher throughput.
|
||||
|
||||
## Quick Start
|
||||
|
||||
See [`configs/glm5_disagg_inference/inference.toml`](../configs/glm5_disagg_inference/inference.toml) for an example config.
|
||||
|
||||
```bash
|
||||
uv run inference @ configs/glm5_disagg_inference/inference.toml --output-dir /data/$USER/outputs
|
||||
```
|
||||
|
||||
## Prefill/Decode Ratio
|
||||
|
||||
| Workload | Recommended ratio (P:D) | Why |
|
||||
|---|---|---|
|
||||
| Agentic (SWE, Lean) | **3:1** | Long growing contexts → prefill-heavy |
|
||||
| Non-agentic (math, chat) | **1:2** | Short prompts, long generations → decode-heavy |
|
||||
|
||||
Monitor live queue depths:
|
||||
```bash
|
||||
curl -s http://<prefill_node>:8100/metrics | grep num_requests_waiting
|
||||
curl -s http://<decode_node>:8200/metrics | grep num_requests_waiting
|
||||
```
|
||||
|
||||
If prefill has queued requests and decode has zero, add more prefill nodes (and vice versa).
|
||||
|
||||
For historical averages (cumulative over the entire run), query the histogram metrics:
|
||||
```bash
|
||||
# Average queue time per request (seconds)
|
||||
curl -s http://<node>:<port>/metrics | awk '
|
||||
/request_queue_time_seconds_sum\{/ { sum += $2 }
|
||||
/request_queue_time_seconds_count\{/ { count += $2 }
|
||||
END { if (count > 0) printf "avg queue: %.2fs (%d requests)\n", sum/count, count }
|
||||
'
|
||||
|
||||
# Average prefill/decode compute time
|
||||
curl -s http://<node>:<port>/metrics | awk '
|
||||
/request_prefill_time_seconds_sum\{/ { ps += $2 }
|
||||
/request_prefill_time_seconds_count\{/ { pc += $2 }
|
||||
/request_decode_time_seconds_sum\{/ { ds += $2 }
|
||||
/request_decode_time_seconds_count\{/ { dc += $2 }
|
||||
END {
|
||||
if (pc > 0) printf "avg prefill: %.2fs\n", ps/pc
|
||||
if (dc > 0) printf "avg decode: %.2fs\n", ds/dc
|
||||
}
|
||||
'
|
||||
```
|
||||
|
||||
Other useful metrics on the `/metrics` endpoint:
|
||||
- `vllm:e2e_request_latency_seconds` — end-to-end latency
|
||||
- `vllm:kv_cache_usage_perc` — KV cache memory pressure
|
||||
- `vllm:nixl_xfer_time_seconds` — NIXL KV transfer duration
|
||||
- `vllm:nixl_bytes_transferred` — bytes per KV transfer
|
||||
|
||||
## UCX 1.19
|
||||
|
||||
NVSHMEM requires UCX >= 1.19 for multi-GPU CUDA support. Most clusters ship UCX 1.17 (via HPC-X), which causes `cuStreamCreate: invalid device context` errors during DeepEP internode dispatch.
|
||||
|
||||
**Check your version:**
|
||||
```bash
|
||||
/opt/hpcx/ucx/bin/ucx_info -v | head -1
|
||||
# If < 1.19, you need to build from source
|
||||
```
|
||||
|
||||
**Build UCX 1.19 (run once on a GPU node):**
|
||||
```bash
|
||||
salloc -N 1 --gres=gpu:1 bash -c 'bash scripts/install_nixl_from_source.sh'
|
||||
```
|
||||
|
||||
This installs UCX 1.19 to `prime-rl/third_party/ucx/`. The sbatch template automatically adds it to `LD_LIBRARY_PATH`, overriding the system version.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### `DeepEP error: timeout (dispatch CPU)`
|
||||
NVSHMEM internode communication failing. Check:
|
||||
1. UCX version >= 1.19? (`third_party/ucx/bin/ucx_info -v`)
|
||||
2. NVSHMEM libs reachable at `/tmp/deepep_build/nvshmem/lib/`? If not:
|
||||
```bash
|
||||
ssh <node> 'mkdir -p /tmp/deepep_build/nvshmem && \
|
||||
ln -sfn <venv>/lib/python3.12/site-packages/nvidia/nvshmem/lib \
|
||||
/tmp/deepep_build/nvshmem/lib'
|
||||
```
|
||||
3. IBGDA driver enabled? `ssh <node> 'cat /proc/driver/nvidia/params | grep EnableStreamMemOPs'` should show `1`.
|
||||
|
||||
### Router healthy but requests hang
|
||||
NIXL side channel not running on prefill. Check:
|
||||
```bash
|
||||
ssh <prefill_node> 'ss -tlnp sport ge :5600 sport le :5608 | grep -c LISTEN'
|
||||
# Should show 8 (one per DP rank). If 0, check logs for UCX/NVSHMEM errors.
|
||||
```
|
||||
+15
-4
@@ -33,6 +33,7 @@ dependencies = [
|
||||
"verifiers",
|
||||
"dion",
|
||||
"tilelang>=0.1.8",
|
||||
"flash-linear-attention",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
@@ -70,11 +71,15 @@ envs = [
|
||||
"aime2024",
|
||||
"aime2025",
|
||||
]
|
||||
disagg = [
|
||||
"deep-ep ; platform_machine == 'x86_64'",
|
||||
"deep-gemm ; platform_machine == 'x86_64'",
|
||||
"nixl",
|
||||
"nixl-cu12 ; platform_machine == 'x86_64'",
|
||||
"vllm-router",
|
||||
]
|
||||
|
||||
[dependency-groups]
|
||||
fp8-inference = [
|
||||
"deep-gemm @ https://github.com/hallerite/DeepGEMM/releases/download/v2.3.0-torch2.9/deep_gemm-2.3.0+35c4bc8-cp312-cp312-linux_x86_64.whl ; platform_machine == 'x86_64'",
|
||||
]
|
||||
mamba-ssm = [
|
||||
"mamba-ssm>=2.3.0",
|
||||
]
|
||||
@@ -105,12 +110,13 @@ override-dependencies = [
|
||||
|
||||
[tool.uv.sources]
|
||||
torch = { index = "pytorch-cu128" }
|
||||
verifiers = { git = "https://github.com/PrimeIntellect-ai/verifiers.git", rev = "1960e77" }
|
||||
verifiers = { git = "https://github.com/PrimeIntellect-ai/verifiers.git", rev = "f5580acd" }
|
||||
torchtitan = { git = "https://github.com/pytorch/torchtitan", rev = "a1fdd7e" }
|
||||
dion = { git = "https://github.com/samsja/dion.git", rev = "d891eeb" }
|
||||
transformers = { git = "https://github.com/huggingface/transformers.git", rev = "5c1c72b" }
|
||||
flash-attn-cute = { git = "https://github.com/Dao-AILab/flash-attention.git", subdirectory = "flash_attn/cute", rev = "e2743ab5" }
|
||||
pydantic-config = { git = "https://github.com/samsja/pydantic_config.git", branch = "main" }
|
||||
vllm-router = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.3/vllm_router-0.1.11-cp38-abi3-linux_x86_64.whl" }
|
||||
reverse-text = { index = "primeintellect" }
|
||||
alphabet-sort = { index = "primeintellect" }
|
||||
wiki-search = { index = "primeintellect" }
|
||||
@@ -123,10 +129,15 @@ color-codeword = { index = "primeintellect" }
|
||||
math500 = { index = "primeintellect" }
|
||||
aime2024 = { index = "primeintellect" }
|
||||
aime2025 = { index = "primeintellect" }
|
||||
deep-ep = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl" }
|
||||
deep-gemm = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_gemm-2.3.0+477618c-cp312-cp312-linux_x86_64.whl" }
|
||||
nixl-cu12 = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl" }
|
||||
flash-linear-attention = { git = "https://github.com/fla-org/flash-linear-attention" }
|
||||
|
||||
[tool.uv.extra-build-dependencies]
|
||||
flash-attn = [{ requirement = "torch", match-runtime = true }]
|
||||
flash-attn-3 = [{ requirement = "torch", match-runtime = true }]
|
||||
mamba-ssm = [{ requirement = "torch", match-runtime = true }]
|
||||
|
||||
[tool.uv.extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build and install DeepGEMM from source for FP8 MoE inference.
|
||||
#
|
||||
# Uses the commit recommended by vLLM for compatibility with vLLM 0.17+.
|
||||
# Requires CUDA 12.8+ and a Hopper/Blackwell GPU.
|
||||
#
|
||||
# Usage:
|
||||
# bash scripts/install_deep_gemm.sh
|
||||
#
|
||||
# Options:
|
||||
# --ref REF DeepGEMM commit hash (default: 477618c)
|
||||
# --wheel-dir DIR Output wheel to DIR instead of installing
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
DEEPGEMM_GIT_REPO="https://github.com/deepseek-ai/DeepGEMM.git"
|
||||
DEEPGEMM_GIT_REF="477618cd51baffca09c4b0b87e97c03fe827ef03"
|
||||
WHEEL_DIR=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--ref) DEEPGEMM_GIT_REF="$2"; shift 2 ;;
|
||||
--wheel-dir) WHEEL_DIR="$2"; shift 2 ;;
|
||||
*) echo "Unknown argument: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Skip if already installed at the right version
|
||||
INSTALLED_VER=$(python -c "import deep_gemm; print(deep_gemm.__version__)" 2>/dev/null || echo "")
|
||||
SHORT_REF="${DEEPGEMM_GIT_REF:0:7}"
|
||||
if [[ "$INSTALLED_VER" == *"$SHORT_REF"* ]]; then
|
||||
echo "DeepGEMM ${INSTALLED_VER} already installed, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Auto-detect CUDA version
|
||||
CUDA_VERSION=$(nvcc --version 2>/dev/null | grep -oP 'release \K[\d.]+' || echo "")
|
||||
if [ -z "$CUDA_VERSION" ]; then
|
||||
echo "ERROR: nvcc not found. CUDA toolkit required." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CUDA_MAJOR="${CUDA_VERSION%%.*}"
|
||||
CUDA_MINOR="${CUDA_VERSION#*.}"
|
||||
CUDA_MINOR="${CUDA_MINOR%%.*}"
|
||||
if [ "$CUDA_MAJOR" -lt 12 ] || { [ "$CUDA_MAJOR" -eq 12 ] && [ "$CUDA_MINOR" -lt 8 ]; }; then
|
||||
echo "Skipping DeepGEMM (requires CUDA 12.8+, got ${CUDA_VERSION})"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "================================================================"
|
||||
echo " Building DeepGEMM (${SHORT_REF})"
|
||||
echo " CUDA: ${CUDA_VERSION}"
|
||||
echo "================================================================"
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
cleanup() { rm -rf "$TMPDIR"; }
|
||||
trap cleanup EXIT
|
||||
|
||||
git clone --recurse-submodules "$DEEPGEMM_GIT_REPO" "$TMPDIR/DeepGEMM" 2>&1
|
||||
cd "$TMPDIR/DeepGEMM"
|
||||
git checkout "$DEEPGEMM_GIT_REF"
|
||||
git submodule update --init --recursive
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
if [ -n "$WHEEL_DIR" ]; then
|
||||
mkdir -p "$WHEEL_DIR"
|
||||
uv build --no-build-isolation --wheel --out-dir "$WHEEL_DIR" "$TMPDIR/DeepGEMM"
|
||||
echo ""
|
||||
echo "Wheel built:"
|
||||
ls -lh "$WHEEL_DIR"/deep_gemm*.whl
|
||||
else
|
||||
uv pip install --no-build-isolation --reinstall "$TMPDIR/DeepGEMM"
|
||||
echo ""
|
||||
echo "Installed: $(python -c 'import deep_gemm; print(deep_gemm.__version__)')"
|
||||
fi
|
||||
|
||||
echo "================================================================"
|
||||
echo " DeepGEMM build complete"
|
||||
echo "================================================================"
|
||||
Executable
+170
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install DeepEP kernels for expert-parallel disaggregated inference.
|
||||
#
|
||||
# Builds NVSHMEM + DeepEP from source and installs into the project venv.
|
||||
# Required for disaggregated prefill/decode deployments with expert parallelism.
|
||||
#
|
||||
# Auto-detects the CUDA toolkit version that matches the installed PyTorch
|
||||
# and looks for it at /usr/local/cuda-X.Y. Fails if not found.
|
||||
#
|
||||
# Prerequisites:
|
||||
# - Matching CUDA toolkit installed (e.g. `sudo apt install cuda-toolkit-12-8`)
|
||||
# - For multi-node: IBGDA driver configured (see --configure-drivers)
|
||||
#
|
||||
# Usage:
|
||||
# bash scripts/install_ep_kernels.sh
|
||||
#
|
||||
# Options:
|
||||
# --workspace DIR Build directory (default: ./ep_kernels_workspace)
|
||||
# --deepep-ref REF DeepEP commit hash (default: 73b6ea4)
|
||||
# --nvshmem-ver VER NVSHMEM version (default: 3.3.24)
|
||||
# --configure-drivers Also configure IBGDA drivers (requires sudo, needs reboot)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
DEEPEP_COMMIT_HASH="73b6ea4"
|
||||
NVSHMEM_VER="3.3.24"
|
||||
WORKSPACE="$REPO_ROOT/ep_kernels_workspace"
|
||||
CONFIGURE_DRIVERS=0
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--workspace) WORKSPACE="$2"; shift 2 ;;
|
||||
--deepep-ref) DEEPEP_COMMIT_HASH="$2"; shift 2 ;;
|
||||
--nvshmem-ver) NVSHMEM_VER="$2"; shift 2 ;;
|
||||
--configure-drivers) CONFIGURE_DRIVERS=1; shift ;;
|
||||
*) echo "Unknown argument: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Skip if DeepEP is already installed
|
||||
if python -c "import deep_ep" 2>/dev/null; then
|
||||
echo "DeepEP already installed, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ── Auto-detect CUDA toolkit matching torch ───────────────────────────────────
|
||||
TORCH_CUDA_VER=$(python -c "import torch; print(torch.version.cuda)")
|
||||
CUDA_MAJOR_MINOR=$(echo "$TORCH_CUDA_VER" | grep -oP '^\d+\.\d+')
|
||||
CUDA_MAJOR=$(echo "$CUDA_MAJOR_MINOR" | cut -d. -f1)
|
||||
|
||||
CUDA_HOME="/usr/local/cuda-${CUDA_MAJOR_MINOR}"
|
||||
if [ ! -x "$CUDA_HOME/bin/nvcc" ]; then
|
||||
echo "ERROR: Could not find CUDA toolkit matching torch (cuda ${TORCH_CUDA_VER}) at ${CUDA_HOME}" >&2
|
||||
echo "Install it with: sudo apt install cuda-toolkit-${CUDA_MAJOR_MINOR//./-}" >&2
|
||||
exit 1
|
||||
fi
|
||||
export CUDA_HOME
|
||||
|
||||
# Verify versions actually match
|
||||
NVCC_VER=$("$CUDA_HOME/bin/nvcc" --version | grep -oP 'release \K[\d.]+')
|
||||
echo "Torch CUDA: ${TORCH_CUDA_VER}, nvcc: ${NVCC_VER} (${CUDA_HOME})"
|
||||
|
||||
# ── Auto-detect GPU architecture ──────────────────────────────────────────────
|
||||
GPU_NAME=$(nvidia-smi --query-gpu=gpu_name --format=csv,noheader,nounits -i 0 2>/dev/null)
|
||||
case "$GPU_NAME" in
|
||||
*H100*|*H200*|*H800*) TORCH_CUDA_ARCH_LIST="9.0" ;;
|
||||
*B100*|*B200*|*GB200*) TORCH_CUDA_ARCH_LIST="10.0" ;;
|
||||
*)
|
||||
echo "Could not auto-detect GPU arch from '$GPU_NAME'. Set TORCH_CUDA_ARCH_LIST manually." >&2
|
||||
echo " Hopper (H100/H200): TORCH_CUDA_ARCH_LIST=9.0" >&2
|
||||
echo " Blackwell (B200): TORCH_CUDA_ARCH_LIST=10.0" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
export TORCH_CUDA_ARCH_LIST
|
||||
|
||||
echo "================================================================"
|
||||
echo " Installing DeepEP kernels"
|
||||
echo " CUDA: ${CUDA_HOME} (${NVCC_VER})"
|
||||
echo " GPU: ${GPU_NAME} (arch ${TORCH_CUDA_ARCH_LIST})"
|
||||
echo " DeepEP: ${DEEPEP_COMMIT_HASH}"
|
||||
echo " NVSHMEM: ${NVSHMEM_VER}"
|
||||
echo " Workspace: ${WORKSPACE}"
|
||||
echo "================================================================"
|
||||
|
||||
mkdir -p "$WORKSPACE"
|
||||
|
||||
# ── Step 1: Install build deps ────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "--- Installing build dependencies ---"
|
||||
cd "$REPO_ROOT"
|
||||
uv pip install cmake ninja
|
||||
|
||||
# ── Step 2: Download and extract NVSHMEM ──────────────────────────────────────
|
||||
echo ""
|
||||
echo "--- Setting up NVSHMEM ${NVSHMEM_VER} ---"
|
||||
|
||||
ARCH=$(uname -m)
|
||||
case "${ARCH,,}" in
|
||||
x86_64|amd64) NVSHMEM_SUBDIR="linux-x86_64" ;;
|
||||
aarch64|arm64) NVSHMEM_SUBDIR="linux-sbsa" ;;
|
||||
*) echo "Unsupported architecture: ${ARCH}" >&2; exit 1 ;;
|
||||
esac
|
||||
|
||||
NVSHMEM_DIR="$WORKSPACE/nvshmem"
|
||||
if [ ! -d "$NVSHMEM_DIR/lib" ]; then
|
||||
NVSHMEM_FILE="libnvshmem-${NVSHMEM_SUBDIR}-${NVSHMEM_VER}_cuda${CUDA_MAJOR}-archive.tar.xz"
|
||||
NVSHMEM_URL="https://developer.download.nvidia.com/compute/nvshmem/redist/libnvshmem/${NVSHMEM_SUBDIR}/${NVSHMEM_FILE}"
|
||||
|
||||
echo "Downloading ${NVSHMEM_URL}"
|
||||
curl -fSL "${NVSHMEM_URL}" -o "$WORKSPACE/${NVSHMEM_FILE}"
|
||||
tar -xf "$WORKSPACE/${NVSHMEM_FILE}" -C "$WORKSPACE"
|
||||
mv "$WORKSPACE/${NVSHMEM_FILE%.tar.xz}" "$NVSHMEM_DIR"
|
||||
rm -f "$WORKSPACE/${NVSHMEM_FILE}"
|
||||
rm -rf "$NVSHMEM_DIR/lib/bin" "$NVSHMEM_DIR/lib/share"
|
||||
echo "NVSHMEM extracted to ${NVSHMEM_DIR}"
|
||||
else
|
||||
echo "NVSHMEM already present at ${NVSHMEM_DIR}, skipping download"
|
||||
fi
|
||||
|
||||
export CMAKE_PREFIX_PATH="${NVSHMEM_DIR}/lib/cmake:${CMAKE_PREFIX_PATH:-}"
|
||||
export NVSHMEM_DIR
|
||||
|
||||
# ── Step 3: Build and install DeepEP ──────────────────────────────────────────
|
||||
echo ""
|
||||
echo "--- Building DeepEP (${DEEPEP_COMMIT_HASH}) ---"
|
||||
|
||||
DEEPEP_DIR="$WORKSPACE/DeepEP"
|
||||
if [ ! -d "$DEEPEP_DIR/.git" ]; then
|
||||
git clone https://github.com/deepseek-ai/DeepEP "$DEEPEP_DIR"
|
||||
fi
|
||||
|
||||
cd "$DEEPEP_DIR"
|
||||
git fetch origin
|
||||
git checkout "$DEEPEP_COMMIT_HASH"
|
||||
|
||||
WHEEL_DIR="$REPO_ROOT/deps"
|
||||
mkdir -p "$WHEEL_DIR"
|
||||
python setup.py bdist_wheel --dist-dir "$WHEEL_DIR"
|
||||
|
||||
WHEEL=$(ls "$WHEEL_DIR"/deep_ep*.whl | head -1)
|
||||
echo ""
|
||||
echo "--- DeepEP wheel built at: $WHEEL ---"
|
||||
|
||||
# ── Step 4 (optional): Configure IBGDA drivers ───────────────────────────────
|
||||
if [ "$CONFIGURE_DRIVERS" -eq 1 ]; then
|
||||
echo ""
|
||||
echo "--- Configuring IBGDA drivers (requires sudo) ---"
|
||||
echo 'options nvidia NVreg_EnableStreamMemOPs=1 NVreg_RegistryDwords="PeerMappingOverride=1;"' | sudo tee -a /etc/modprobe.d/nvidia.conf
|
||||
if command -v update-initramfs &> /dev/null; then
|
||||
sudo update-initramfs -u
|
||||
elif command -v dracut &> /dev/null; then
|
||||
sudo dracut --force
|
||||
else
|
||||
echo "No supported initramfs update tool found." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
echo "IBGDA configured. Please REBOOT the system to apply changes."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "================================================================"
|
||||
echo " DeepEP installation complete"
|
||||
echo " NVSHMEM: ${NVSHMEM_DIR}"
|
||||
echo " To verify: uv run python -c 'import deep_ep; print(deep_ep.__file__)'"
|
||||
echo "================================================================"
|
||||
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Build UCX 1.19.x with CUDA + IB support, then build NIXL against it.
|
||||
# Installs the unrepaired wheel (no auditwheel) so NIXL uses the UCX libs
|
||||
# directly from third_party/ucx/ at runtime via LD_LIBRARY_PATH.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
VENV_BIN="$PROJECT_DIR/.venv/bin"
|
||||
PYTHON="$VENV_BIN/python"
|
||||
|
||||
WORKSPACE="$PROJECT_DIR/nixl_workspace"
|
||||
mkdir -p "$WORKSPACE"
|
||||
UCX_SRC="$WORKSPACE/ucx_source"
|
||||
UCX_INSTALL="$PROJECT_DIR/third_party/ucx"
|
||||
NIXL_SRC="$WORKSPACE/nixl_source"
|
||||
NIXL_VERSION="${NIXL_VERSION:-0.10.1}"
|
||||
CUDA_PATH="${CUDA_HOME:-/usr/local/cuda}"
|
||||
NPROC=$(nproc)
|
||||
|
||||
export PATH="$VENV_BIN:$PATH"
|
||||
|
||||
echo "=== Building UCX 1.19.x with CUDA + IB ==="
|
||||
if [ ! -d "$UCX_SRC" ]; then
|
||||
git clone https://github.com/openucx/ucx.git "$UCX_SRC"
|
||||
fi
|
||||
cd "$UCX_SRC"
|
||||
git checkout v1.19.x
|
||||
|
||||
if [ ! -f "$UCX_INSTALL/lib/libucs.so" ]; then
|
||||
./autogen.sh
|
||||
./configure \
|
||||
--prefix="$UCX_INSTALL" \
|
||||
--enable-shared \
|
||||
--disable-static \
|
||||
--disable-doxygen-doc \
|
||||
--enable-optimizations \
|
||||
--enable-cma \
|
||||
--enable-devel-headers \
|
||||
--enable-mt \
|
||||
--with-verbs \
|
||||
--with-cuda="$CUDA_PATH" \
|
||||
--with-ze=no
|
||||
make -j"$NPROC"
|
||||
make install
|
||||
echo "=== UCX installed to $UCX_INSTALL ==="
|
||||
else
|
||||
echo "=== UCX already built, skipping ==="
|
||||
fi
|
||||
|
||||
echo "=== Building NIXL $NIXL_VERSION ==="
|
||||
if [ ! -d "$NIXL_SRC" ]; then
|
||||
git clone https://github.com/ai-dynamo/nixl.git "$NIXL_SRC"
|
||||
else
|
||||
cd "$NIXL_SRC" && git fetch --tags
|
||||
fi
|
||||
cd "$NIXL_SRC"
|
||||
git checkout "$NIXL_VERSION"
|
||||
|
||||
export PKG_CONFIG_PATH="$UCX_INSTALL/lib/pkgconfig"
|
||||
export LD_LIBRARY_PATH="$UCX_INSTALL/lib:$UCX_INSTALL/lib/ucx:${LD_LIBRARY_PATH:-}"
|
||||
|
||||
# Build and install directly (no auditwheel) so NIXL links to our UCX at runtime
|
||||
WHEEL_DIR="$PROJECT_DIR/deps"
|
||||
mkdir -p "$WHEEL_DIR"
|
||||
uv pip install pip 2>/dev/null
|
||||
"$PYTHON" -m pip wheel . --no-deps --wheel-dir="$WHEEL_DIR"
|
||||
|
||||
WHEEL=$(ls "$WHEEL_DIR"/nixl*.whl | head -1)
|
||||
echo "=== NIXL wheel built at: $WHEEL ==="
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Builds the patched vllm-router wheel (Rust via setuptools-rust) from our fork.
|
||||
# Requires: Rust toolchain (cargo), Python 3.8+, and uv or pip.
|
||||
# Override output dir: VLLM_ROUTER_WHEEL_DIR=/path/to/dir
|
||||
set -euo pipefail
|
||||
|
||||
REPO_URL="https://github.com/S1ro1/router.git"
|
||||
BRANCH="fix/preserve-extra-fields-disagg"
|
||||
BUILD_DIR="/tmp/vllm-router-build"
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
OUTPUT_DIR="${VLLM_ROUTER_WHEEL_DIR:-$SCRIPT_DIR/deps}"
|
||||
|
||||
echo "Cloning $REPO_URL (branch: $BRANCH)..."
|
||||
rm -rf "$BUILD_DIR"
|
||||
git clone --depth 1 --branch "$BRANCH" "$REPO_URL" "$BUILD_DIR"
|
||||
|
||||
echo "Building wheel -> $OUTPUT_DIR ..."
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
if command -v uv >/dev/null 2>&1; then
|
||||
uv build --wheel --out-dir "$OUTPUT_DIR" "$BUILD_DIR"
|
||||
else
|
||||
(cd "$BUILD_DIR" && python3 -m pip wheel . --no-deps -w "$OUTPUT_DIR")
|
||||
fi
|
||||
|
||||
echo "Cleaning up..."
|
||||
rm -rf "$BUILD_DIR"
|
||||
|
||||
wheel=$(ls -1t "$OUTPUT_DIR"/*.whl 2>/dev/null | head -1)
|
||||
echo "Done. Wheel: $wheel"
|
||||
echo "Install: uv pip install $wheel"
|
||||
@@ -138,9 +138,34 @@ class MultiNodeInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
|
||||
|
||||
num_nodes: Annotated[int, Field(ge=1, description="Number of inference nodes.")] = 2
|
||||
|
||||
router_port: Annotated[int, Field(description="Port for the vllm-router.")] = 8000
|
||||
backend_port: Annotated[int, Field(description="Port for vLLM backend instances.")] = 8100
|
||||
|
||||
|
||||
class DisaggregatedInferenceDeploymentConfig(BaseInferenceDeploymentConfig):
|
||||
"""Configures a disaggregated prefill/decode inference deployment.
|
||||
|
||||
Each inference replica is split into separate prefill and decode node groups.
|
||||
Requires NIXL for KV transfer and a vllm-router for request routing.
|
||||
"""
|
||||
|
||||
type: Literal["disaggregated"] = "disaggregated"
|
||||
|
||||
num_prefill_nodes: Annotated[int, Field(ge=1, description="Number of prefill nodes per replica.")] = 1
|
||||
num_decode_nodes: Annotated[int, Field(ge=1, description="Number of decode nodes per replica.")] = 1
|
||||
|
||||
router_port: Annotated[int, Field(description="Port for the vllm-router on each replica.")] = 8000
|
||||
prefill_port: Annotated[int, Field(description="Port for prefill vLLM instances.")] = 8100
|
||||
decode_port: Annotated[int, Field(description="Port for decode vLLM instances.")] = 8200
|
||||
|
||||
@property
|
||||
def num_nodes(self) -> int:
|
||||
return self.num_prefill_nodes + self.num_decode_nodes
|
||||
|
||||
|
||||
InferenceDeploymentConfig: TypeAlias = Annotated[
|
||||
SingleNodeInferenceDeploymentConfig | MultiNodeInferenceDeploymentConfig, Field(discriminator="type")
|
||||
SingleNodeInferenceDeploymentConfig | MultiNodeInferenceDeploymentConfig | DisaggregatedInferenceDeploymentConfig,
|
||||
Field(discriminator="type"),
|
||||
]
|
||||
|
||||
|
||||
@@ -204,8 +229,8 @@ class InferenceConfig(BaseConfig):
|
||||
api_server_count: Annotated[
|
||||
int,
|
||||
Field(
|
||||
ge=1,
|
||||
description="The number of API servers to use. Passed to vLLM as `--api-server-count`",
|
||||
ge=0,
|
||||
description="The number of API servers to use. Passed to vLLM as `--api-server-count`. Set to 0 for headless mode.",
|
||||
),
|
||||
] = 1
|
||||
|
||||
@@ -254,6 +279,13 @@ class InferenceConfig(BaseConfig):
|
||||
),
|
||||
] = False
|
||||
|
||||
use_deep_gemm: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
description="Force DeepGEMM FP8 kernels via VLLM_USE_DEEP_GEMM=1. Only works with per-tensor FP8 quantization (e.g. GLM-5-FP8).",
|
||||
),
|
||||
] = False
|
||||
|
||||
weight_broadcast: Annotated[WeightBroadcastConfig, Field(description="The weight broadcast config.")] = (
|
||||
WeightBroadcastConfig()
|
||||
)
|
||||
@@ -298,6 +330,25 @@ class InferenceConfig(BaseConfig):
|
||||
raise ValueError("Must use SLURM for multi-node deployment.")
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_disaggregated(self):
|
||||
"""Auto-configure inference for disaggregated P/D: enable EP and compute DP."""
|
||||
if self.deployment.type == "disaggregated":
|
||||
if "enable_expert_parallel" not in self.model_fields_set:
|
||||
self.enable_expert_parallel = True
|
||||
if "enable_eplb" not in self.model_fields_set:
|
||||
self.enable_eplb = False
|
||||
gpus_per_node = self.deployment.gpus_per_node
|
||||
tp = self.parallel.tp
|
||||
dp_per_node = gpus_per_node // tp
|
||||
if self.data_parallel_size_local is None:
|
||||
self.data_parallel_size_local = dp_per_node
|
||||
if self.parallel.dp == 1:
|
||||
self.parallel.dp = dp_per_node
|
||||
if self.api_server_count == 1:
|
||||
self.api_server_count = dp_per_node
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_slurm_template(self):
|
||||
if self.slurm is not None and self.slurm.template_path is None:
|
||||
@@ -332,6 +383,10 @@ class InferenceConfig(BaseConfig):
|
||||
size. Unless LoRA is enabled, in which case only one API server is
|
||||
supported (vLLM limitation).
|
||||
"""
|
||||
if self.vllm_extra.get("headless", False):
|
||||
self.api_server_count = 0
|
||||
return self
|
||||
|
||||
if "api_server_count" not in self.model_fields_set:
|
||||
min_api_server_count = self.data_parallel_size_local or self.parallel.dp
|
||||
if self.api_server_count < min_api_server_count:
|
||||
|
||||
@@ -650,6 +650,14 @@ class NCCLWeightBroadcastConfig(BaseModel):
|
||||
Field(description="Use kernel-format FP8 quantized NCCL transfer for weight updates."),
|
||||
] = False
|
||||
|
||||
inference_world_size: Annotated[
|
||||
int,
|
||||
Field(
|
||||
ge=1,
|
||||
description="Total number of inference GPUs across all servers. Used by init_nccl_broadcast to compute per-server rank offsets.",
|
||||
),
|
||||
] = 1
|
||||
|
||||
|
||||
WeightBroadcastConfig: TypeAlias = Annotated[
|
||||
FileSystemWeightBroadcastConfig | NCCLWeightBroadcastConfig, Field(discriminator="type")
|
||||
|
||||
@@ -192,9 +192,16 @@ class MultiNodeDeploymentConfig(BaseDeploymentConfig):
|
||||
int,
|
||||
Field(
|
||||
ge=0,
|
||||
description="Number of inference nodes. Set to 0 to skip inference and orchestrator (requires fake data).",
|
||||
description="Number of inference nodes per replica. Set to 0 to skip inference and orchestrator (requires fake data).",
|
||||
),
|
||||
]
|
||||
num_infer_replicas: Annotated[
|
||||
int,
|
||||
Field(
|
||||
ge=1,
|
||||
description="Number of independent inference replicas. Total inference nodes = num_infer_nodes * num_infer_replicas.",
|
||||
),
|
||||
] = 1
|
||||
num_teacher_nodes: Annotated[int | None, Field(description="Number of teacher inference nodes.")] = None
|
||||
|
||||
nodes_per_fsdp_group: Annotated[
|
||||
@@ -204,6 +211,10 @@ class MultiNodeDeploymentConfig(BaseDeploymentConfig):
|
||||
),
|
||||
] = None
|
||||
|
||||
@property
|
||||
def total_infer_nodes(self) -> int:
|
||||
return self.num_infer_nodes * self.num_infer_replicas
|
||||
|
||||
@model_validator(mode="after")
|
||||
def teacher_inference_not_supported(self):
|
||||
if self.num_teacher_nodes is not None:
|
||||
@@ -596,6 +607,7 @@ class RLConfig(BaseConfig):
|
||||
type=self.weight_broadcast.type,
|
||||
port=self.weight_broadcast.port,
|
||||
timeout=self.weight_broadcast.timeout,
|
||||
inference_world_size=inference_world_size,
|
||||
quantize_in_weight_transfer=self.weight_broadcast.quantize_in_weight_transfer,
|
||||
)
|
||||
elif self.weight_broadcast.type == "filesystem":
|
||||
@@ -679,6 +691,13 @@ class RLConfig(BaseConfig):
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_session_headers(self):
|
||||
"""Auto-configure X-Session-ID header for sticky routing at the inference router."""
|
||||
if "extra_headers_from_state" not in self.orchestrator.client.model_fields_set:
|
||||
self.orchestrator.client.extra_headers_from_state = {"X-Session-ID": "example_id"}
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_router_replay(self):
|
||||
if self.trainer.enable_router_replay:
|
||||
@@ -724,7 +743,11 @@ class RLConfig(BaseConfig):
|
||||
self.deployment.num_train_nodes // self.deployment.nodes_per_fsdp_group
|
||||
)
|
||||
|
||||
if self.inference is not None and self.inference.enable_expert_parallel:
|
||||
if (
|
||||
self.inference is not None
|
||||
and self.inference.enable_expert_parallel
|
||||
and self.inference.deployment.type != "disaggregated"
|
||||
):
|
||||
inference_tp = self.inference.parallel.tp
|
||||
if self.deployment.gpus_per_node % inference_tp != 0:
|
||||
raise ValueError(
|
||||
@@ -753,11 +776,38 @@ class RLConfig(BaseConfig):
|
||||
self.inference.api_server_count = inferred_dp_local
|
||||
|
||||
if self.weight_broadcast is not None and self.weight_broadcast.type == "nccl":
|
||||
total_infer_gpus = self.deployment.gpus_per_node * self.deployment.total_infer_nodes
|
||||
assert self.trainer.weight_broadcast.type == "nccl"
|
||||
self.trainer.weight_broadcast.host = "0.0.0.0"
|
||||
self.trainer.weight_broadcast.inference_world_size = (
|
||||
self.deployment.gpus_per_node * self.deployment.num_infer_nodes
|
||||
)
|
||||
self.trainer.weight_broadcast.inference_world_size = total_infer_gpus
|
||||
assert self.orchestrator.weight_broadcast.type == "nccl"
|
||||
self.orchestrator.weight_broadcast.inference_world_size = total_infer_gpus
|
||||
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def auto_setup_disaggregated_inference(self):
|
||||
"""Auto-setup for disaggregated P/D inference within a multi-node deployment."""
|
||||
if self.inference is None or self.inference.deployment.type != "disaggregated":
|
||||
return self
|
||||
if self.deployment.type != "multi_node":
|
||||
return self
|
||||
|
||||
infer_deploy = self.inference.deployment
|
||||
expected_infer_nodes = infer_deploy.num_prefill_nodes + infer_deploy.num_decode_nodes
|
||||
if self.deployment.num_infer_nodes != expected_infer_nodes:
|
||||
raise ValueError(
|
||||
f"deployment.num_infer_nodes ({self.deployment.num_infer_nodes}) must equal "
|
||||
f"inference.deployment.num_prefill_nodes ({infer_deploy.num_prefill_nodes}) + "
|
||||
f"inference.deployment.num_decode_nodes ({infer_deploy.num_decode_nodes}) = {expected_infer_nodes}"
|
||||
)
|
||||
|
||||
total_infer_gpus = self.deployment.total_infer_nodes * self.deployment.gpus_per_node
|
||||
if self.weight_broadcast is not None and self.weight_broadcast.type == "nccl":
|
||||
assert self.trainer.weight_broadcast.type == "nccl"
|
||||
self.trainer.weight_broadcast.inference_world_size = total_infer_gpus
|
||||
assert self.orchestrator.weight_broadcast.type == "nccl"
|
||||
self.orchestrator.weight_broadcast.inference_world_size = total_infer_gpus
|
||||
|
||||
return self
|
||||
|
||||
|
||||
@@ -196,6 +196,15 @@ class ClientConfig(BaseConfig):
|
||||
),
|
||||
] = {}
|
||||
|
||||
extra_headers_from_state: Annotated[
|
||||
dict[str, str],
|
||||
Field(
|
||||
description="Maps HTTP header names to state field names. For each inference request, "
|
||||
"the header value is dynamically read from the rollout state dict. "
|
||||
'e.g. {"X-Session-ID": "example_id"} enables sticky routing at the inference router.',
|
||||
),
|
||||
] = {}
|
||||
|
||||
skip_model_check: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
@@ -219,6 +228,16 @@ class ClientConfig(BaseConfig):
|
||||
),
|
||||
] = 1
|
||||
|
||||
admin_base_url: Annotated[
|
||||
list[str] | None,
|
||||
Field(
|
||||
description="Separate base URLs for admin operations (weight updates, health checks). "
|
||||
"When set, admin clients use these URLs instead of base_url, allowing weight "
|
||||
"updates to bypass routers and hit each server directly. Used in disaggregated "
|
||||
"P/D deployments where the inference router should not handle admin traffic.",
|
||||
),
|
||||
] = None
|
||||
|
||||
elastic: Annotated[
|
||||
ElasticConfig | None,
|
||||
Field(
|
||||
|
||||
@@ -474,6 +474,13 @@ class CheckpointConfig(BaseConfig):
|
||||
|
||||
weights: WeightCheckpointConfig | None = WeightCheckpointConfig()
|
||||
|
||||
skip_gather_master_weights: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
description="When true, skip gathering and saving HF-compatible weight checkpoints. Useful for large models where the gather is expensive and only DCP checkpoints are needed.",
|
||||
),
|
||||
] = False
|
||||
|
||||
weights_only: Annotated[
|
||||
bool,
|
||||
Field(
|
||||
|
||||
@@ -32,15 +32,38 @@ def write_slurm_script(config: InferenceConfig, config_path: Path, script_path:
|
||||
env = Environment(loader=FileSystemLoader(config.slurm.template_path.parent), keep_trailing_newline=True)
|
||||
template = env.get_template(config.slurm.template_path.name)
|
||||
|
||||
script = template.render(
|
||||
is_disaggregated = config.deployment.type == "disaggregated"
|
||||
|
||||
template_vars = dict(
|
||||
**config.slurm.template_vars,
|
||||
config_path=config_path,
|
||||
output_dir=config.output_dir,
|
||||
gpus_per_node=config.deployment.gpus_per_node,
|
||||
num_nodes=config.deployment.num_nodes if config.deployment.type == "multi_node" else 1,
|
||||
num_nodes=getattr(config.deployment, "num_nodes", 1),
|
||||
port=config.server.port,
|
||||
disaggregated=is_disaggregated,
|
||||
)
|
||||
|
||||
is_multi_node = config.deployment.type == "multi_node"
|
||||
|
||||
if is_disaggregated:
|
||||
template_vars.update(
|
||||
num_prefill_nodes=config.deployment.num_prefill_nodes,
|
||||
num_decode_nodes=config.deployment.num_decode_nodes,
|
||||
prefill_port=config.deployment.prefill_port,
|
||||
decode_port=config.deployment.decode_port,
|
||||
router_port=config.deployment.router_port,
|
||||
data_parallel_rpc_port=config.data_parallel_rpc_port,
|
||||
use_deep_gemm=config.use_deep_gemm,
|
||||
)
|
||||
elif is_multi_node:
|
||||
template_vars.update(
|
||||
router_port=config.deployment.router_port,
|
||||
backend_port=config.deployment.backend_port,
|
||||
)
|
||||
|
||||
script = template.render(**template_vars)
|
||||
|
||||
script_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
script_path.write_text(script)
|
||||
|
||||
@@ -52,7 +75,11 @@ def inference_slurm(config: InferenceConfig):
|
||||
logger = setup_logger("info")
|
||||
|
||||
config_dir = get_config_dir(config.output_dir)
|
||||
exclude = {"deployment", "slurm", "dry_run"} if config.deployment.type == "multi_node" else {"slurm", "dry_run"}
|
||||
exclude = (
|
||||
{"deployment", "slurm", "dry_run"}
|
||||
if config.deployment.type in ("multi_node", "disaggregated")
|
||||
else {"slurm", "dry_run"}
|
||||
)
|
||||
config_path = write_config(config, config_dir, exclude=exclude)
|
||||
logger.info(f"Wrote config to {config_path}")
|
||||
|
||||
|
||||
@@ -58,8 +58,10 @@ def write_subconfigs(config: RLConfig, output_dir: Path) -> None:
|
||||
tomli_w.dump(config.orchestrator.model_dump(exclude_none=True, mode="json"), f)
|
||||
|
||||
if config.inference is not None:
|
||||
# Exclude launcher-only fields that are not needed by the vLLM server
|
||||
exclude_inference = {"deployment", "slurm", "output_dir", "dry_run"}
|
||||
with open(output_dir / INFERENCE_TOML, "wb") as f:
|
||||
tomli_w.dump(config.inference.model_dump(exclude_none=True, mode="json"), f)
|
||||
tomli_w.dump(config.inference.model_dump(exclude=exclude_inference, exclude_none=True, mode="json"), f)
|
||||
|
||||
teacher_inference = getattr(config, "teacher_inference", None)
|
||||
if teacher_inference is not None:
|
||||
@@ -402,16 +404,46 @@ def write_slurm_script(config: RLConfig, config_dir: Path, script_path: Path) ->
|
||||
output_dir=config.output_dir,
|
||||
gpus_per_node=config.deployment.gpus_per_node,
|
||||
)
|
||||
elif config.inference is not None and config.inference.deployment.type == "disaggregated":
|
||||
infer_deploy = config.inference.deployment
|
||||
|
||||
script = template.render(
|
||||
**config.slurm.template_vars,
|
||||
is_disaggregated=True,
|
||||
config_dir=config_dir,
|
||||
output_dir=config.output_dir,
|
||||
orchestrator_output_dir=config.orchestrator.output_dir,
|
||||
num_train_nodes=config.deployment.num_train_nodes,
|
||||
num_infer_nodes=infer_deploy.num_nodes * config.deployment.num_infer_replicas,
|
||||
nodes_per_infer_replica=infer_deploy.num_nodes,
|
||||
num_infer_replicas=config.deployment.num_infer_replicas,
|
||||
num_prefill_nodes=infer_deploy.num_prefill_nodes,
|
||||
num_decode_nodes=infer_deploy.num_decode_nodes,
|
||||
gpus_per_node=config.deployment.gpus_per_node,
|
||||
router_port=infer_deploy.router_port,
|
||||
prefill_port=infer_deploy.prefill_port,
|
||||
decode_port=infer_deploy.decode_port,
|
||||
inference_tp=config.inference.parallel.tp,
|
||||
inference_data_parallel_rpc_port=config.inference.data_parallel_rpc_port,
|
||||
use_deep_gemm=config.inference.use_deep_gemm,
|
||||
use_nccl_broadcast=config.weight_broadcast is not None and config.weight_broadcast.type == "nccl",
|
||||
wandb_shared=config.wandb is not None and config.wandb.shared,
|
||||
)
|
||||
else:
|
||||
script = template.render(
|
||||
**config.slurm.template_vars,
|
||||
is_disaggregated=False,
|
||||
config_dir=config_dir, # TODO: should prob have each subconfig path separately
|
||||
output_dir=config.output_dir,
|
||||
orchestrator_output_dir=config.orchestrator.output_dir,
|
||||
num_train_nodes=config.deployment.num_train_nodes,
|
||||
num_infer_nodes=config.deployment.num_infer_nodes,
|
||||
num_infer_nodes=config.deployment.total_infer_nodes,
|
||||
nodes_per_infer_replica=config.deployment.num_infer_nodes,
|
||||
num_infer_replicas=config.deployment.num_infer_replicas,
|
||||
num_teacher_nodes=config.deployment.num_teacher_nodes,
|
||||
gpus_per_node=config.deployment.gpus_per_node,
|
||||
router_port=getattr(config.inference.deployment, "router_port", 8000) if config.inference else 8000,
|
||||
backend_port=getattr(config.inference.deployment, "backend_port", 8100) if config.inference else 8100,
|
||||
inference_tp=config.inference.parallel.tp if config.inference else 1,
|
||||
inference_enable_expert_parallel=config.inference.enable_expert_parallel if config.inference else False,
|
||||
inference_data_parallel_rpc_port=config.inference.data_parallel_rpc_port if config.inference else 29600,
|
||||
|
||||
@@ -10,6 +10,7 @@ def transformers_v5_compat():
|
||||
Qwen3VLMoeTextConfig.tie_word_embeddings = False
|
||||
|
||||
_patch_qwen35_lora()
|
||||
monkey_patch_dp_engine_core_pause_resume_deadlock()
|
||||
|
||||
|
||||
def _patch_qwen35_lora():
|
||||
@@ -712,3 +713,35 @@ def monkey_patch_fused_moe_lora_dp():
|
||||
self.base_layer._replace_quant_method(new_method)
|
||||
|
||||
FusedMoEWithLoRA._inject_lora_into_fused_moe = _fixed_inject
|
||||
|
||||
|
||||
def monkey_patch_dp_engine_core_pause_resume_deadlock():
|
||||
"""Fix deadlock with pause/resume and collective_rpc in DP engine core.
|
||||
|
||||
When a request arrives for an already-completed wave while the scheduler is
|
||||
paused, the unpatched code sends a start_wave notification that triggers
|
||||
collective_rpc on other DP engines. But the paused engine can't participate
|
||||
in the collective, causing a deadlock.
|
||||
|
||||
Fix: only send the start_wave notification when the scheduler is unpaused,
|
||||
and explicitly set engines_running=True before notifying.
|
||||
|
||||
Upstream: https://github.com/vllm-project/vllm/pull/37024
|
||||
"""
|
||||
from vllm.v1.core.sched.interface import PauseState
|
||||
from vllm.v1.engine import EngineCoreOutputs
|
||||
from vllm.v1.engine.core import DPEngineCoreProc, EngineCore
|
||||
from vllm.v1.request import Request
|
||||
|
||||
_base_add_request = EngineCore.add_request
|
||||
|
||||
def _patched_add_request(self, request: Request, request_wave: int = 0):
|
||||
_base_add_request(self, request, request_wave)
|
||||
if self.has_coordinator and request_wave != self.current_wave:
|
||||
if request_wave > self.current_wave:
|
||||
self.current_wave = request_wave
|
||||
elif not self.engines_running and self.scheduler.pause_state == PauseState.UNPAUSED:
|
||||
self.engines_running = True
|
||||
self.output_queue.put_nowait((-1, EngineCoreOutputs(start_wave=self.current_wave)))
|
||||
|
||||
DPEngineCoreProc.add_request = _patched_add_request
|
||||
|
||||
@@ -39,6 +39,9 @@ MODEL_TOOL_CALL_PARSER: dict[str, str] = {
|
||||
"zai-org/GLM-4.7": "glm47",
|
||||
"zai-org/GLM-4.7-FP8": "glm47",
|
||||
"zai-org/GLM-4.7-Flash": "glm47",
|
||||
# GLM-5
|
||||
"zai-org/GLM-5": "glm47",
|
||||
"zai-org/GLM-5-FP8": "glm47",
|
||||
# MiniMax M2
|
||||
"MiniMaxAI/MiniMax-M2": "minimax_m2",
|
||||
"MiniMaxAI/MiniMax-M2.1": "minimax_m2",
|
||||
@@ -117,6 +120,9 @@ MODEL_TOOL_CALL_PARSER: dict[str, str] = {
|
||||
"Qwen/Qwen3.5-122B-A10B-FP8": "qwen3_coder",
|
||||
"Qwen/Qwen3.5-397B-A17B": "qwen3_coder",
|
||||
"Qwen/Qwen3.5-397B-A17B-FP8": "qwen3_coder",
|
||||
# NemotronH
|
||||
"nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-BF16": "qwen3_coder",
|
||||
"nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16": "qwen3_coder",
|
||||
}
|
||||
|
||||
|
||||
@@ -183,11 +189,22 @@ def chat_with_tokens(request: Request) -> OpenAIServingChatWithTokens | None:
|
||||
return request.app.state.openai_serving_chat_with_tokens
|
||||
|
||||
|
||||
@router.post("/pause")
|
||||
async def pause(request: Request):
|
||||
await engine_client(request).pause_generation(mode="keep", clear_cache=False)
|
||||
return {"status": "paused"}
|
||||
|
||||
|
||||
@router.post("/resume")
|
||||
async def resume(request: Request):
|
||||
await engine_client(request).resume_generation()
|
||||
return {"status": "resumed"}
|
||||
|
||||
|
||||
@router.post("/update_weights")
|
||||
async def update_weights(request: Request):
|
||||
data = await request.json()
|
||||
await engine_client(request).collective_rpc("update_weights_from_path", args=(data.get("weight_dir"),))
|
||||
# Reset prefix cache to invalidate KV states computed with old weights
|
||||
await engine_client(request).reset_prefix_cache()
|
||||
return {"status": "ok"}
|
||||
|
||||
@@ -214,13 +231,13 @@ async def init_broadcaster(request: Request):
|
||||
host = data.get("host")
|
||||
port = data.get("port")
|
||||
timeout = data.get("timeout")
|
||||
rank_offset = data.get("rank_offset")
|
||||
inference_world_size = data.get("inference_world_size")
|
||||
gpus_per_server = data.get("gpus_per_server")
|
||||
quantize_in_weight_transfer = data.get("quantize_in_weight_transfer", False)
|
||||
# Support both legacy and new field names
|
||||
server_rank = data.get("server_rank")
|
||||
num_inference_server = data.get("num_inference_server")
|
||||
await engine_client(request).collective_rpc(
|
||||
"init_broadcaster",
|
||||
args=(host, port, server_rank, num_inference_server, timeout, quantize_in_weight_transfer),
|
||||
args=(host, port, rank_offset, inference_world_size, gpus_per_server, timeout, quantize_in_weight_transfer),
|
||||
)
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@@ -96,29 +96,39 @@ class NCCLWeightUpdateWorker(Worker):
|
||||
self,
|
||||
host: str,
|
||||
port: int,
|
||||
server_rank: int,
|
||||
num_inference_server: int,
|
||||
rank_offset: int,
|
||||
inference_world_size: int,
|
||||
gpus_per_server: int,
|
||||
timeout: int,
|
||||
quantize_in_weight_transfer: bool = False,
|
||||
) -> None:
|
||||
"""Initialize the NCCL broadcast receiver."""
|
||||
"""Initialize the NCCL broadcast receiver.
|
||||
|
||||
Args:
|
||||
rank_offset: Starting GPU offset for this server in the global inference group.
|
||||
inference_world_size: Total number of inference GPUs across all servers.
|
||||
gpus_per_server: Number of GPUs managed by this server instance.
|
||||
"""
|
||||
self.quantize_in_weight_transfer = quantize_in_weight_transfer
|
||||
tp_size = get_tp_group().world_size
|
||||
tp_rank = get_tp_group().rank_in_group
|
||||
dp_size = get_dp_group().world_size
|
||||
dp_rank = get_dp_group().rank_in_group
|
||||
global_rank_inference = (server_rank * tp_size * dp_size) + (dp_rank * tp_size) + tp_rank
|
||||
global_inference_world_size = num_inference_server * tp_size * dp_size
|
||||
# Use modulo to get the local DP rank within this server (needed when
|
||||
# the DP group spans multiple nodes in distributed EP mode).
|
||||
local_dp_rank = dp_rank % (gpus_per_server // tp_size)
|
||||
local_rank = local_dp_rank * tp_size + tp_rank
|
||||
global_rank_inference = rank_offset + local_rank
|
||||
|
||||
logger.info(
|
||||
f"Worker [tp={tp_rank} dp={dp_rank} server_rank={server_rank}] -> [global_rank={global_rank_inference} global_world_size={global_inference_world_size}]"
|
||||
f"Worker [tp={tp_rank} dp={dp_rank} local_dp={local_dp_rank} rank_offset={rank_offset}] "
|
||||
f"-> [global_rank={global_rank_inference} inference_world_size={inference_world_size}]"
|
||||
)
|
||||
|
||||
self.nccl_broadcast_receiver = NCCLWeightBroadcastReceiver(
|
||||
host=host,
|
||||
port=port,
|
||||
rank=global_rank_inference + 1, # +1 as the trainer broadcaster is on rank 0
|
||||
world_size=global_inference_world_size + 1, # +1 as the trainer broadcaster is on rank 0
|
||||
world_size=inference_world_size + 1, # +1 as the trainer broadcaster is on rank 0
|
||||
device=self.device,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
@@ -352,6 +352,7 @@ async def orchestrate(config: OrchestratorConfig):
|
||||
config.weight_broadcast.host,
|
||||
config.weight_broadcast.port,
|
||||
config.weight_broadcast.timeout,
|
||||
inference_world_size=config.weight_broadcast.inference_world_size,
|
||||
quantize_in_weight_transfer=config.weight_broadcast.quantize_in_weight_transfer,
|
||||
)
|
||||
else:
|
||||
@@ -513,7 +514,7 @@ async def orchestrate(config: OrchestratorConfig):
|
||||
else:
|
||||
val_task = asyncio.create_task(asyncio.sleep(0)) # Dummy task
|
||||
|
||||
# Await train rollouts, process results and write batch to disk to consume by trainer
|
||||
# Await train rollouts
|
||||
await train_task
|
||||
generate_completions_time = scheduler.last_batch_generation_time
|
||||
train_rollouts = train_task.result()
|
||||
@@ -550,9 +551,13 @@ async def orchestrate(config: OrchestratorConfig):
|
||||
for rollout in train_rollouts:
|
||||
pretokenize_rollout_trajectory(rollout, tokenizer, processor=processor)
|
||||
|
||||
# VLM: build image cache for efficient batched preprocessing
|
||||
# VLM: build image cache in a thread so it doesn't block the event loop.
|
||||
# This lets the scheduler continue servicing inflight rollout requests
|
||||
# and — with max_async_level >= 2 — overlap with the next batch's inference.
|
||||
if is_vlm:
|
||||
vlm_cache = build_vlm_image_cache(train_rollouts, processor)
|
||||
vlm_cache = await asyncio.get_event_loop().run_in_executor(
|
||||
rollout_executor, build_vlm_image_cache, train_rollouts, processor
|
||||
)
|
||||
logger.info(
|
||||
f"VLM timing: extract={vlm_cache.extract_time:.2f}s, preprocess={vlm_cache.preprocess_time:.2f}s "
|
||||
f"({vlm_cache.num_unique_images} unique images from {vlm_cache.num_unique_examples} examples)"
|
||||
|
||||
@@ -24,6 +24,18 @@
|
||||
# Configs
|
||||
export NUM_NODES={{ num_nodes }}
|
||||
export GPUS_PER_NODE={{ gpus_per_node }}
|
||||
{% if disaggregated -%}
|
||||
export NUM_PREFILL_NODES={{ num_prefill_nodes }}
|
||||
export NUM_DECODE_NODES={{ num_decode_nodes }}
|
||||
export NODES_PER_REPLICA=$((NUM_PREFILL_NODES + NUM_DECODE_NODES))
|
||||
export PREFILL_PORT={{ prefill_port }}
|
||||
export DECODE_PORT={{ decode_port }}
|
||||
export ROUTER_PORT={{ router_port }}
|
||||
export RPC_PORT={{ data_parallel_rpc_port }}
|
||||
{%- elif num_nodes > 1 %}
|
||||
export ROUTER_PORT={{ router_port }}
|
||||
export BACKEND_PORT={{ backend_port }}
|
||||
{%- endif %}
|
||||
|
||||
# Paths
|
||||
export PROJECT_DIR={{ project_dir }}
|
||||
@@ -35,6 +47,7 @@ mkdir -p $OUTPUT_DIR/slurm
|
||||
export CUDA_DEVICE_ORDER=PCI_BUS_ID
|
||||
export PYTHONUNBUFFERED=1
|
||||
export OMP_NUM_THREADS=1
|
||||
export VLLM_CACHE_ROOT=/tmp/.vllm_cache_$(whoami)
|
||||
|
||||
# Setup environment
|
||||
cd $PROJECT_DIR
|
||||
@@ -44,14 +57,43 @@ uv sync --all-extras
|
||||
|
||||
# Print inference URLs
|
||||
export HOSTNAMES=( $( scontrol show hostnames $SLURM_JOB_NODELIST ) )
|
||||
export HOSTNAMES_STR="${HOSTNAMES[*]}"
|
||||
{% if disaggregated -%}
|
||||
# Build per-replica router URLs
|
||||
INFER_URLS=""
|
||||
for host in ${HOSTNAMES[@]}; do
|
||||
if [ -z "$INFER_URLS" ]; then
|
||||
INFER_URLS="http://$host:{{ port }}/v1"
|
||||
else
|
||||
INFER_URLS="$INFER_URLS,http://$host:{{ port }}/v1"
|
||||
fi
|
||||
ALL_ROUTER_ARGS=""
|
||||
for ((r=0; r<NUM_NODES/NODES_PER_REPLICA; r++)); do
|
||||
replica_base=$((r * NODES_PER_REPLICA))
|
||||
router_host="${HOSTNAMES[$replica_base]}"
|
||||
INFER_URLS="${INFER_URLS:+$INFER_URLS,}http://${router_host}:${ROUTER_PORT}/v1"
|
||||
|
||||
REPLICA_ROUTER_ARGS=""
|
||||
for ((p=0; p<NUM_PREFILL_NODES; p++)); do
|
||||
node_idx=$((replica_base + p))
|
||||
host="${HOSTNAMES[$node_idx]}"
|
||||
REPLICA_ROUTER_ARGS="$REPLICA_ROUTER_ARGS --prefill http://${host}:${PREFILL_PORT}"
|
||||
done
|
||||
for ((d=0; d<NUM_DECODE_NODES; d++)); do
|
||||
node_idx=$((replica_base + NUM_PREFILL_NODES + d))
|
||||
host="${HOSTNAMES[$node_idx]}"
|
||||
REPLICA_ROUTER_ARGS="$REPLICA_ROUTER_ARGS --decode http://${host}:${DECODE_PORT}"
|
||||
done
|
||||
ALL_ROUTER_ARGS="${ALL_ROUTER_ARGS:+$ALL_ROUTER_ARGS|}$REPLICA_ROUTER_ARGS"
|
||||
done
|
||||
export INFER_URLS
|
||||
export ALL_ROUTER_ARGS
|
||||
{%- elif num_nodes > 1 %}
|
||||
# Single router on node 0, all nodes as backends
|
||||
INFER_URLS="http://${HOSTNAMES[0]}:${ROUTER_PORT}/v1"
|
||||
ROUTER_ARGS=""
|
||||
for host in ${HOSTNAMES[@]}; do
|
||||
ROUTER_ARGS="$ROUTER_ARGS http://${host}:${BACKEND_PORT}"
|
||||
done
|
||||
export INFER_URLS
|
||||
export ROUTER_ARGS
|
||||
{%- else %}
|
||||
INFER_URLS="http://${HOSTNAMES[0]}:{{ port }}/v1"
|
||||
{%- endif %}
|
||||
echo "HOSTNAMES=${HOSTNAMES[@]}"
|
||||
echo "INFER_URLS=${INFER_URLS}"
|
||||
|
||||
@@ -60,18 +102,146 @@ echo "INFER_URLS=${INFER_URLS}"
|
||||
{{ pre_run_command }}
|
||||
{% endif %}
|
||||
|
||||
# Run inference (each node runs an independent vLLM replica)
|
||||
# Run inference
|
||||
srun bash -c '
|
||||
cd $PROJECT_DIR
|
||||
[ -f .env ] && source .env
|
||||
source .venv/bin/activate
|
||||
|
||||
# Infiniband setup
|
||||
IB_HCA=$(ibv_devinfo | sed -n -e "/hca_id/p" -e "/link_layer:/p" | grep -B1 InfiniBand | grep hca_id | sed -e "s/^hca_id://g" | tr -d "[[:blank:]]" |paste -sd,)
|
||||
export NCCL_IB_HCA=$IB_HCA
|
||||
IB_HCA=$(ibv_devinfo 2>/dev/null | sed -n -e "/hca_id/p" -e "/link_layer:/p" | grep -B1 InfiniBand | grep hca_id | sed -e "s/^hca_id://g" | tr -d "[[:blank:]]" | paste -sd,)
|
||||
[ -n "$IB_HCA" ] && export NCCL_IB_HCA=$IB_HCA
|
||||
|
||||
INFER_NODE_RANK=$SLURM_PROCID
|
||||
LOCAL_IP=$(hostname -I | awk "{print \$1}")
|
||||
|
||||
{% if disaggregated -%}
|
||||
# NVSHMEM libs for DeepEP — ensure the rpath target exists on all nodes
|
||||
if [ ! -d /tmp/deepep_build/nvshmem/lib ] && [ -d "$OUTPUT_DIR/nvshmem/lib" ]; then
|
||||
mkdir -p /tmp/deepep_build/nvshmem
|
||||
ln -sfn "$OUTPUT_DIR/nvshmem/lib" /tmp/deepep_build/nvshmem/lib
|
||||
fi
|
||||
|
||||
# Reconstruct hostnames array
|
||||
read -ra HOSTNAMES <<< "$HOSTNAMES_STR"
|
||||
|
||||
export VLLM_WORKER_MULTIPROC_METHOD=spawn
|
||||
{%- if use_deep_gemm %}
|
||||
export VLLM_USE_DEEP_GEMM=1
|
||||
{%- endif %}
|
||||
export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:False"
|
||||
export GLOO_SOCKET_IFNAME=bond0
|
||||
export VLLM_ENGINE_READY_TIMEOUT_S=4200
|
||||
export UCX_TLS=all
|
||||
export UCX_NET_DEVICES=all
|
||||
export LD_LIBRARY_PATH="$PROJECT_DIR/third_party/ucx/lib:$PROJECT_DIR/third_party/ucx/lib/ucx:${LD_LIBRARY_PATH:-}"
|
||||
|
||||
export VLLM_NIXL_SIDE_CHANNEL_HOST=$LOCAL_IP
|
||||
export VLLM_NIXL_SIDE_CHANNEL_PORT=5600
|
||||
|
||||
KV_CFG='"'"'{"kv_connector":"NixlConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_threads":1}}'"'"'
|
||||
DECODE_COMPILE_CFG='"'"'{"cudagraph_mode":"FULL_DECODE_ONLY"}'"'"'
|
||||
|
||||
# Determine replica and role
|
||||
REPLICA_IDX=$((INFER_NODE_RANK / NODES_PER_REPLICA))
|
||||
RANK_IN_REPLICA=$((INFER_NODE_RANK % NODES_PER_REPLICA))
|
||||
|
||||
if [ "$RANK_IN_REPLICA" -lt "$NUM_PREFILL_NODES" ]; then
|
||||
# ── Prefill node ──
|
||||
ROLE="prefill"
|
||||
ROLE_RANK=$RANK_IN_REPLICA
|
||||
EP=$((NUM_PREFILL_NODES * GPUS_PER_NODE))
|
||||
PORT=$PREFILL_PORT
|
||||
START_RANK=$((ROLE_RANK * GPUS_PER_NODE))
|
||||
HEAD_HOST="${HOSTNAMES[$((REPLICA_IDX * NODES_PER_REPLICA))]}"
|
||||
|
||||
ROLE_EXTRA="\"all2all_backend\": \"deepep_high_throughput\""
|
||||
|
||||
if [ "$ROLE_RANK" -eq 0 ]; then
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$LOCAL_IP\", \"data_parallel_hybrid_lb\": true, \"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
else
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$HEAD_HOST\", \"data_parallel_start_rank\": $START_RANK, \"data_parallel_hybrid_lb\": true, \"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
fi
|
||||
else
|
||||
# ── Decode node ──
|
||||
export UCX_NET_DEVICES=mlx5_0:1
|
||||
ROLE="decode"
|
||||
ROLE_RANK=$((RANK_IN_REPLICA - NUM_PREFILL_NODES))
|
||||
EP=$((NUM_DECODE_NODES * GPUS_PER_NODE))
|
||||
PORT=$DECODE_PORT
|
||||
START_RANK=$((ROLE_RANK * GPUS_PER_NODE))
|
||||
HEAD_HOST="${HOSTNAMES[$((REPLICA_IDX * NODES_PER_REPLICA + NUM_PREFILL_NODES))]}"
|
||||
|
||||
ROLE_EXTRA="\"all2all_backend\": \"deepep_low_latency\", \"compilation_config\": $DECODE_COMPILE_CFG"
|
||||
|
||||
if [ "$ROLE_RANK" -eq 0 ]; then
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$LOCAL_IP\", \"data_parallel_hybrid_lb\": true, \"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
else
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$HEAD_HOST\", \"data_parallel_start_rank\": $START_RANK, \"data_parallel_hybrid_lb\": true, \"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "NODE_RANK=$INFER_NODE_RANK ROLE=$ROLE REPLICA=$REPLICA_IDX ROLE_RANK=$ROLE_RANK EP=$EP PORT=$PORT LOCAL_IP=$LOCAL_IP" \
|
||||
| tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
|
||||
# Start vllm-router on the first prefill node of each replica (background)
|
||||
if [ "$RANK_IN_REPLICA" -eq 0 ]; then
|
||||
ROUTER_LOG="$OUTPUT_DIR/slurm/latest_router_replica_${REPLICA_IDX}.log"
|
||||
echo "Starting vllm-router on $LOCAL_IP:$ROUTER_PORT for replica $REPLICA_IDX" | tee $ROUTER_LOG
|
||||
|
||||
REPLICA_ROUTER_ARGS=$(echo "$ALL_ROUTER_ARGS" | cut -d"|" -f$((REPLICA_IDX + 1)))
|
||||
|
||||
vllm-router \
|
||||
--policy round_robin \
|
||||
--vllm-pd-disaggregation \
|
||||
$REPLICA_ROUTER_ARGS \
|
||||
--host 0.0.0.0 \
|
||||
--port $ROUTER_PORT \
|
||||
--intra-node-data-parallel-size 1 \
|
||||
--worker-startup-timeout-secs 1200 \
|
||||
--log-level debug \
|
||||
>> $ROUTER_LOG 2>&1 &
|
||||
fi
|
||||
|
||||
uv run inference \
|
||||
@ $CONFIG_PATH \
|
||||
--server.host 0.0.0.0 \
|
||||
--server.port $PORT \
|
||||
--parallel.dp $EP \
|
||||
--data-parallel-rpc-port $RPC_PORT \
|
||||
--vllm-extra "$VLLM_EXTRA" \
|
||||
2>&1 | tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
{%- elif num_nodes > 1 %}
|
||||
echo "INFER_NODE_RANK=${INFER_NODE_RANK}, LOCAL_IP=${LOCAL_IP}" \
|
||||
| tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
|
||||
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False
|
||||
|
||||
# Start router on node 0
|
||||
if [ "$INFER_NODE_RANK" -eq 0 ]; then
|
||||
ROUTER_LOG="$OUTPUT_DIR/slurm/latest_router.log"
|
||||
echo "Starting vllm-router on $LOCAL_IP:$ROUTER_PORT" | tee $ROUTER_LOG
|
||||
|
||||
vllm-router \
|
||||
--policy round_robin \
|
||||
--worker-urls $ROUTER_ARGS \
|
||||
--host 0.0.0.0 \
|
||||
--port $ROUTER_PORT \
|
||||
--worker-startup-timeout-secs 1200 \
|
||||
--log-level debug \
|
||||
>> $ROUTER_LOG 2>&1 &
|
||||
fi
|
||||
|
||||
uv run inference \
|
||||
@ $CONFIG_PATH \
|
||||
--server.host 0.0.0.0 \
|
||||
--server.port $BACKEND_PORT \
|
||||
2>&1 | tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
{%- else %}
|
||||
echo "INFER_NODE_RANK=${INFER_NODE_RANK}, LOCAL_IP=${LOCAL_IP}" | tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log $OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
|
||||
# Required for graph compilation to work
|
||||
@@ -80,4 +250,5 @@ srun bash -c '
|
||||
uv run inference \
|
||||
@ $CONFIG_PATH \
|
||||
2>&1 | tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log $OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
{%- endif %}
|
||||
'
|
||||
|
||||
@@ -24,19 +24,30 @@
|
||||
# Configs
|
||||
export NUM_TRAIN_NODES={{ num_train_nodes }}
|
||||
export NUM_INFER_NODES={{ num_infer_nodes }}
|
||||
export NODES_PER_INFER_REPLICA={{ nodes_per_infer_replica }}
|
||||
export NUM_INFER_REPLICAS={{ num_infer_replicas }}
|
||||
export GPUS_PER_NODE={{ gpus_per_node }}
|
||||
{% if num_infer_nodes > 0 -%}
|
||||
export ROUTER_PORT={{ router_port }}
|
||||
export INFERENCE_TP={{ inference_tp }}
|
||||
export INFERENCE_ENABLE_EXPERT_PARALLEL={{ "1" if inference_enable_expert_parallel else "0" }}
|
||||
export INFERENCE_DATA_PARALLEL_RPC_PORT={{ inference_data_parallel_rpc_port }}
|
||||
export INFERENCE_DP_LOCAL=$((GPUS_PER_NODE / INFERENCE_TP))
|
||||
export INFERENCE_DATA_PARALLEL_RPC_PORT={{ inference_data_parallel_rpc_port }}
|
||||
{% if is_disaggregated -%}
|
||||
export NUM_PREFILL_NODES={{ num_prefill_nodes }}
|
||||
export NUM_DECODE_NODES={{ num_decode_nodes }}
|
||||
export PREFILL_PORT={{ prefill_port }}
|
||||
export DECODE_PORT={{ decode_port }}
|
||||
{%- else -%}
|
||||
export BACKEND_PORT={{ backend_port }}
|
||||
export INFERENCE_ENABLE_EXPERT_PARALLEL={{ "1" if inference_enable_expert_parallel else "0" }}
|
||||
|
||||
# Enable distributed EP mode only when expert parallelism spans multiple inference nodes.
|
||||
# Enable distributed EP mode only when expert parallelism spans multiple inference nodes per replica.
|
||||
export USE_DISTRIBUTED_EP=0
|
||||
if [ "$INFERENCE_ENABLE_EXPERT_PARALLEL" -eq 1 ] && [ "$NUM_INFER_NODES" -gt 1 ]; then
|
||||
if [ "$INFERENCE_ENABLE_EXPERT_PARALLEL" -eq 1 ] && [ "$NODES_PER_INFER_REPLICA" -gt 1 ]; then
|
||||
USE_DISTRIBUTED_EP=1
|
||||
fi
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
# Paths
|
||||
export PROJECT_DIR={{ project_dir }}
|
||||
@@ -69,25 +80,58 @@ export HOSTNAMES_STR="${HOSTNAMES[*]}"
|
||||
|
||||
{% if num_infer_nodes > 0 -%}
|
||||
INFER_HOSTS=( ${HOSTNAMES[@]:0:$NUM_INFER_NODES} )
|
||||
export INFER_HEAD_HOST="${INFER_HOSTS[0]}"
|
||||
|
||||
# Build per-replica router URLs, admin URLs, and backend args for the router
|
||||
INFER_URLS=""
|
||||
if [ "$USE_DISTRIBUTED_EP" -eq 1 ]; then
|
||||
INFER_URLS="http://${INFER_HEAD_HOST}:8000/v1"
|
||||
else
|
||||
for host in "${INFER_HOSTS[@]}"; do
|
||||
if [ -z "$INFER_URLS" ]; then
|
||||
INFER_URLS="http://$host:8000/v1"
|
||||
else
|
||||
INFER_URLS="$INFER_URLS http://$host:8000/v1"
|
||||
fi
|
||||
ADMIN_URLS=""
|
||||
ALL_ROUTER_ARGS=""
|
||||
{% if is_disaggregated -%}
|
||||
for ((r=0; r<NUM_INFER_REPLICAS; r++)); do
|
||||
replica_base=$((r * NODES_PER_INFER_REPLICA))
|
||||
router_host="${INFER_HOSTS[$replica_base]}"
|
||||
INFER_URLS="${INFER_URLS:+$INFER_URLS }http://${router_host}:${ROUTER_PORT}/v1"
|
||||
|
||||
REPLICA_ROUTER_ARGS=""
|
||||
for ((p=0; p<NUM_PREFILL_NODES; p++)); do
|
||||
node_idx=$((replica_base + p))
|
||||
host="${INFER_HOSTS[$node_idx]}"
|
||||
ADMIN_URLS="${ADMIN_URLS:+$ADMIN_URLS }http://${host}:${PREFILL_PORT}/v1"
|
||||
REPLICA_ROUTER_ARGS="$REPLICA_ROUTER_ARGS --prefill http://${host}:${PREFILL_PORT}"
|
||||
done
|
||||
fi
|
||||
for ((d=0; d<NUM_DECODE_NODES; d++)); do
|
||||
node_idx=$((replica_base + NUM_PREFILL_NODES + d))
|
||||
host="${INFER_HOSTS[$node_idx]}"
|
||||
ADMIN_URLS="${ADMIN_URLS:+$ADMIN_URLS }http://${host}:${DECODE_PORT}/v1"
|
||||
REPLICA_ROUTER_ARGS="$REPLICA_ROUTER_ARGS --decode http://${host}:${DECODE_PORT}"
|
||||
done
|
||||
ALL_ROUTER_ARGS="${ALL_ROUTER_ARGS:+$ALL_ROUTER_ARGS|}$REPLICA_ROUTER_ARGS"
|
||||
done
|
||||
{%- else -%}
|
||||
for ((r=0; r<NUM_INFER_REPLICAS; r++)); do
|
||||
head_idx=$((r * NODES_PER_INFER_REPLICA))
|
||||
router_host="${INFER_HOSTS[$head_idx]}"
|
||||
INFER_URLS="${INFER_URLS:+$INFER_URLS }http://${router_host}:${ROUTER_PORT}/v1"
|
||||
|
||||
REPLICA_ROUTER_ARGS=""
|
||||
for ((n=0; n<NODES_PER_INFER_REPLICA; n++)); do
|
||||
node_idx=$((head_idx + n))
|
||||
host="${INFER_HOSTS[$node_idx]}"
|
||||
ADMIN_URLS="${ADMIN_URLS:+$ADMIN_URLS }http://${host}:${BACKEND_PORT}/v1"
|
||||
REPLICA_ROUTER_ARGS="$REPLICA_ROUTER_ARGS http://${host}:${BACKEND_PORT}"
|
||||
done
|
||||
ALL_ROUTER_ARGS="${ALL_ROUTER_ARGS:+$ALL_ROUTER_ARGS|}$REPLICA_ROUTER_ARGS"
|
||||
done
|
||||
{%- endif %}
|
||||
export INFER_URLS
|
||||
export ADMIN_URLS
|
||||
export ALL_ROUTER_ARGS
|
||||
echo "INFER_HOSTS=${INFER_HOSTS[*]}"
|
||||
echo "INFER_URLS=${INFER_URLS}"
|
||||
echo "ADMIN_URLS=${ADMIN_URLS}"
|
||||
{%- if not is_disaggregated %}
|
||||
echo "USE_DISTRIBUTED_EP=${USE_DISTRIBUTED_EP}"
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
echo "HOSTNAMES=${HOSTNAMES[*]}"
|
||||
echo "TRAIN_HOSTS=${TRAIN_HOSTS[*]}"
|
||||
@@ -125,33 +169,145 @@ srun bash -c '
|
||||
export NCCL_IB_HCA=$IB_HCA
|
||||
|
||||
{% if num_infer_nodes > 0 -%}
|
||||
|
||||
if [ "$SLURM_PROCID" -lt "$NUM_INFER_NODES" ]; then
|
||||
export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:False"
|
||||
INFER_NODE_RANK=$SLURM_PROCID
|
||||
export VLLM_WORKER_MULTIPROC_METHOD=spawn
|
||||
LOCAL_IP=$(hostname -I | awk "{print \$1}")
|
||||
|
||||
REPLICA_IDX=$((INFER_NODE_RANK / NODES_PER_INFER_REPLICA))
|
||||
RANK_IN_REPLICA=$((INFER_NODE_RANK % NODES_PER_INFER_REPLICA))
|
||||
|
||||
echo "INFER_NODE_RANK=$INFER_NODE_RANK REPLICA=$REPLICA_IDX RANK_IN_REPLICA=$RANK_IN_REPLICA LOCAL_IP=$LOCAL_IP" \
|
||||
| tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
|
||||
{% if is_disaggregated -%}
|
||||
# PD disaggregated: NIXL KV transfer + role-based inference
|
||||
read -ra HOSTNAMES <<< "$HOSTNAMES_STR"
|
||||
{%- if use_deep_gemm %}
|
||||
export VLLM_USE_DEEP_GEMM=1
|
||||
{%- endif %}
|
||||
|
||||
export GLOO_SOCKET_IFNAME=bond0
|
||||
export VLLM_ENGINE_READY_TIMEOUT_S=4200
|
||||
export UCX_TLS=all
|
||||
export UCX_NET_DEVICES=all
|
||||
export LD_LIBRARY_PATH="$PROJECT_DIR/third_party/ucx/lib:$PROJECT_DIR/third_party/ucx/lib/ucx:${LD_LIBRARY_PATH:-}"
|
||||
export VLLM_NIXL_SIDE_CHANNEL_HOST=$LOCAL_IP
|
||||
export VLLM_NIXL_SIDE_CHANNEL_PORT=5600
|
||||
|
||||
KV_CFG='"'"'{"kv_connector":"NixlConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_threads":1}}'"'"'
|
||||
DECODE_COMPILE_CFG='"'"'{"cudagraph_mode":"FULL_DECODE_ONLY"}'"'"'
|
||||
|
||||
if [ "$RANK_IN_REPLICA" -lt "$NUM_PREFILL_NODES" ]; then
|
||||
ROLE="prefill"
|
||||
ROLE_RANK=$RANK_IN_REPLICA
|
||||
DP=$((NUM_PREFILL_NODES * INFERENCE_DP_LOCAL))
|
||||
PORT=$PREFILL_PORT
|
||||
START_RANK=$((ROLE_RANK * INFERENCE_DP_LOCAL))
|
||||
HEAD_HOST="${HOSTNAMES[$((REPLICA_IDX * NODES_PER_INFER_REPLICA))]}"
|
||||
ROLE_EXTRA="\"all2all_backend\": \"deepep_high_throughput\""
|
||||
else
|
||||
export UCX_NET_DEVICES=mlx5_0:1
|
||||
ROLE="decode"
|
||||
ROLE_RANK=$((RANK_IN_REPLICA - NUM_PREFILL_NODES))
|
||||
DP=$((NUM_DECODE_NODES * INFERENCE_DP_LOCAL))
|
||||
PORT=$DECODE_PORT
|
||||
START_RANK=$((ROLE_RANK * INFERENCE_DP_LOCAL))
|
||||
HEAD_HOST="${HOSTNAMES[$((REPLICA_IDX * NODES_PER_INFER_REPLICA + NUM_PREFILL_NODES))]}"
|
||||
ROLE_EXTRA="\"all2all_backend\": \"deepep_low_latency\", \"compilation_config\": $DECODE_COMPILE_CFG"
|
||||
fi
|
||||
|
||||
echo "ROLE=$ROLE REPLICA=$REPLICA_IDX ROLE_RANK=$ROLE_RANK DP=$DP PORT=$PORT" \
|
||||
| tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
|
||||
if [ "$DP" -gt 1 ]; then
|
||||
if [ "$ROLE_RANK" -eq 0 ]; then
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$LOCAL_IP\", \"data_parallel_hybrid_lb\": true, \"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
else
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$HEAD_HOST\", \"data_parallel_start_rank\": $START_RANK, \"data_parallel_hybrid_lb\": true, \"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
fi
|
||||
else
|
||||
VLLM_EXTRA="{\"kv_transfer_config\": $KV_CFG, $ROLE_EXTRA}"
|
||||
fi
|
||||
|
||||
# Start vllm-router on the first node of each replica (PD mode)
|
||||
if [ "$RANK_IN_REPLICA" -eq 0 ]; then
|
||||
ROUTER_LOG="$OUTPUT_DIR/slurm/latest_router_replica_${REPLICA_IDX}.log"
|
||||
echo "Starting vllm-router (PD) on $LOCAL_IP:$ROUTER_PORT for replica $REPLICA_IDX" | tee $ROUTER_LOG
|
||||
|
||||
REPLICA_ROUTER_ARGS=$(echo "$ALL_ROUTER_ARGS" | cut -d"|" -f$((REPLICA_IDX + 1)))
|
||||
|
||||
vllm-router \
|
||||
--policy round_robin \
|
||||
--vllm-pd-disaggregation \
|
||||
$REPLICA_ROUTER_ARGS \
|
||||
--host 0.0.0.0 \
|
||||
--port $ROUTER_PORT \
|
||||
--intra-node-data-parallel-size 1 \
|
||||
--worker-startup-timeout-secs 1200 \
|
||||
--log-level debug \
|
||||
>> $ROUTER_LOG 2>&1 &
|
||||
fi
|
||||
|
||||
uv run inference \
|
||||
@ $CONFIG_DIR/inference.toml \
|
||||
--server.host 0.0.0.0 \
|
||||
--server.port $PORT \
|
||||
--parallel.dp $DP \
|
||||
--data-parallel-rpc-port $INFERENCE_DATA_PARALLEL_RPC_PORT \
|
||||
--vllm-extra "$VLLM_EXTRA" \
|
||||
2>&1 | tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
{%- else -%}
|
||||
# Start vllm-router on the first node of each replica
|
||||
if [ "$RANK_IN_REPLICA" -eq 0 ]; then
|
||||
ROUTER_LOG="$OUTPUT_DIR/slurm/latest_router_replica_${REPLICA_IDX}.log"
|
||||
echo "Starting vllm-router on $LOCAL_IP:$ROUTER_PORT for replica $REPLICA_IDX" | tee $ROUTER_LOG
|
||||
|
||||
REPLICA_ROUTER_ARGS=$(echo "$ALL_ROUTER_ARGS" | cut -d"|" -f$((REPLICA_IDX + 1)))
|
||||
|
||||
vllm-router \
|
||||
--policy round_robin \
|
||||
--worker-urls $REPLICA_ROUTER_ARGS \
|
||||
--host 0.0.0.0 \
|
||||
--port $ROUTER_PORT \
|
||||
--worker-startup-timeout-secs 1200 \
|
||||
--log-level debug \
|
||||
>> $ROUTER_LOG 2>&1 &
|
||||
fi
|
||||
|
||||
if [ "$USE_DISTRIBUTED_EP" -eq 1 ]; then
|
||||
INFER_DP_START_RANK=$((INFER_NODE_RANK * INFERENCE_DP_LOCAL))
|
||||
if [ "$INFER_NODE_RANK" -eq 0 ]; then
|
||||
uv run inference \
|
||||
@ $CONFIG_DIR/inference.toml \
|
||||
--data-parallel-address $INFER_HEAD_HOST \
|
||||
--data-parallel-rpc-port $INFERENCE_DATA_PARALLEL_RPC_PORT \
|
||||
2>&1 | tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log $OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
read -ra HOSTNAMES <<< "$HOSTNAMES_STR"
|
||||
REPLICA_HEAD_HOST="${HOSTNAMES[$((REPLICA_IDX * NODES_PER_INFER_REPLICA))]}"
|
||||
INFER_DP_START_RANK=$((RANK_IN_REPLICA * INFERENCE_DP_LOCAL))
|
||||
|
||||
if [ "$RANK_IN_REPLICA" -eq 0 ]; then
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$LOCAL_IP\"}"
|
||||
else
|
||||
uv run inference \
|
||||
@ $CONFIG_DIR/inference.toml \
|
||||
--data-parallel-start-rank $INFER_DP_START_RANK \
|
||||
--data-parallel-address $INFER_HEAD_HOST \
|
||||
--data-parallel-rpc-port $INFERENCE_DATA_PARALLEL_RPC_PORT \
|
||||
--headless \
|
||||
2>&1 | tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log $OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
VLLM_EXTRA="{\"data_parallel_address\": \"$REPLICA_HEAD_HOST\", \"data_parallel_start_rank\": $INFER_DP_START_RANK}"
|
||||
fi
|
||||
|
||||
uv run inference \
|
||||
@ $CONFIG_DIR/inference.toml \
|
||||
--server.host 0.0.0.0 \
|
||||
--server.port $BACKEND_PORT \
|
||||
--data-parallel-rpc-port $INFERENCE_DATA_PARALLEL_RPC_PORT \
|
||||
--vllm-extra "$VLLM_EXTRA" \
|
||||
2>&1 | tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
else
|
||||
uv run inference \
|
||||
@ $CONFIG_DIR/inference.toml \
|
||||
2>&1 | tee $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log $OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
--server.host 0.0.0.0 \
|
||||
--server.port $BACKEND_PORT \
|
||||
2>&1 | tee -a $OUTPUT_DIR/slurm/latest_infer_node_rank_${INFER_NODE_RANK}.log \
|
||||
$OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_infer_node_rank_${INFER_NODE_RANK}.log
|
||||
fi
|
||||
{%- endif %}
|
||||
|
||||
else
|
||||
TRAIN_NODE_RANK=$((SLURM_PROCID - NUM_INFER_NODES))
|
||||
@@ -159,6 +315,7 @@ else
|
||||
if [ "$TRAIN_NODE_RANK" -eq 0 ]; then
|
||||
ORCHESTRATOR_ARGS="@ $CONFIG_DIR/orchestrator.toml"
|
||||
ORCHESTRATOR_ARGS="$ORCHESTRATOR_ARGS --client.base-url $INFER_URLS"
|
||||
ORCHESTRATOR_ARGS="$ORCHESTRATOR_ARGS --client.admin-base-url $ADMIN_URLS"
|
||||
{% if use_nccl_broadcast %}ORCHESTRATOR_ARGS="$ORCHESTRATOR_ARGS --weight_broadcast.host $MASTER_ADDR"
|
||||
{% endif %}{% if wandb_shared %}WANDB_SHARED_LABEL=orchestrator {% endif %}uv run orchestrator $ORCHESTRATOR_ARGS \
|
||||
2>&1 | tee $OUTPUT_DIR/slurm/latest_orchestrator.log $OUTPUT_DIR/slurm/job_${SLURM_JOB_ID}_orchestrator.log &
|
||||
|
||||
@@ -461,7 +461,7 @@ def setup_ckpt_managers(
|
||||
return None, None
|
||||
ckpt_output_dir = ckpt_config.output_dir or output_dir
|
||||
ckpt_manager = CheckpointManager(ckpt_output_dir, ckpt_config)
|
||||
if ckpt_config.weights:
|
||||
if ckpt_config.weights and not ckpt_config.skip_gather_master_weights:
|
||||
weight_ckpt_manager = WeightCheckpointManager(
|
||||
ckpt_output_dir,
|
||||
ckpt_config.weights,
|
||||
|
||||
@@ -41,7 +41,7 @@ from prime_rl.trainer.weights import (
|
||||
)
|
||||
from prime_rl.trainer.world import get_world
|
||||
from prime_rl.utils.logger import get_logger
|
||||
from prime_rl.utils.vlm import get_language_model, get_vision_encoder
|
||||
from prime_rl.utils.vlm import get_language_model, get_vision_encoder, is_vlm_architecture
|
||||
|
||||
|
||||
def _patch_qwen3_5_moe_conversion_mapping():
|
||||
@@ -193,8 +193,7 @@ def get_model(
|
||||
f"Loading model config (name={config.name}, attn={config.attn}, trust_remote_code={config.trust_remote_code})"
|
||||
)
|
||||
|
||||
# VLM mode is enabled by setting [model.vlm] in config
|
||||
is_vlm = config.vlm is not None
|
||||
is_vlm_training = config.vlm is not None
|
||||
|
||||
if "Qwen3.5" in config.name or "qwen3_5" in config.name.lower():
|
||||
_patch_qwen3_5_text_position_ids()
|
||||
@@ -207,9 +206,14 @@ def get_model(
|
||||
),
|
||||
)
|
||||
model_config.use_cache = False
|
||||
is_vlm_arch = is_vlm_architecture(model_config)
|
||||
|
||||
if is_vlm:
|
||||
if is_vlm_training:
|
||||
logger.info(f"Detected vision-language model: {config.name}")
|
||||
if config.optimization_dtype != "bfloat16" or config.reduce_dtype != "bfloat16":
|
||||
raise ValueError(
|
||||
"VLM models must use optimization_dtype='bfloat16' and reduce_dtype='bfloat16' to match vLLM inference."
|
||||
)
|
||||
|
||||
# Fallback Qwen3.5 patch detection from loaded config model_type
|
||||
if getattr(model_config, "model_type", "").startswith("qwen3_5_moe"):
|
||||
@@ -248,16 +252,18 @@ def get_model(
|
||||
logger.debug(f"Loaded model config ({model_config.to_dict()})")
|
||||
|
||||
if config.debug.num_layers is not None:
|
||||
num_hidden_layers = min(config.debug.num_layers, model_config.num_hidden_layers)
|
||||
# VLM configs nest num_hidden_layers under text_config
|
||||
target_config = getattr(model_config, "text_config", model_config)
|
||||
num_hidden_layers = min(config.debug.num_layers, target_config.num_hidden_layers)
|
||||
logger.warning(
|
||||
f"Setting the number of layers to {config.debug.num_layers} in the model config. This means {model_config.num_hidden_layers - num_hidden_layers} layers will not be loaded."
|
||||
f"Setting the number of layers to {config.debug.num_layers} in the model config. This means {target_config.num_hidden_layers - num_hidden_layers} layers will not be loaded."
|
||||
)
|
||||
model_config.num_hidden_layers = num_hidden_layers
|
||||
target_config.num_hidden_layers = num_hidden_layers
|
||||
|
||||
# Determine the implementation to use
|
||||
custom_vlm_cls = get_custom_vlm_cls(model_config) if is_vlm else None
|
||||
custom_vlm_cls = get_custom_vlm_cls(model_config) if is_vlm_arch else None
|
||||
if config.impl == "auto":
|
||||
if is_vlm:
|
||||
if is_vlm_arch:
|
||||
impl_to_use = "custom" if custom_vlm_cls is not None else "hf"
|
||||
else:
|
||||
impl_to_use = "custom" if supports_custom_impl(model_config) else "hf"
|
||||
@@ -266,13 +272,12 @@ def get_model(
|
||||
impl_to_use = config.impl
|
||||
|
||||
with device:
|
||||
if is_vlm:
|
||||
if impl_to_use == "custom" and custom_vlm_cls is not None:
|
||||
model_cls = custom_vlm_cls
|
||||
else:
|
||||
from transformers import AutoModelForImageTextToText
|
||||
if impl_to_use == "custom" and custom_vlm_cls is not None:
|
||||
model_cls = custom_vlm_cls
|
||||
elif is_vlm_arch:
|
||||
from transformers import AutoModelForImageTextToText
|
||||
|
||||
model_cls = AutoModelForImageTextToText
|
||||
model_cls = AutoModelForImageTextToText
|
||||
else:
|
||||
match impl_to_use:
|
||||
case "hf":
|
||||
@@ -282,7 +287,7 @@ def get_model(
|
||||
|
||||
load_model_start_time = time.perf_counter()
|
||||
# HF VLM models require torch_dtype; custom PrimeRL models and text Auto models use dtype
|
||||
use_torch_dtype = is_vlm and model_cls is not custom_vlm_cls
|
||||
use_torch_dtype = is_vlm_arch and model_cls is not custom_vlm_cls
|
||||
dtype_kwarg = {"torch_dtype": dtype} if use_torch_dtype else {"dtype": dtype}
|
||||
if device == torch.device("meta"):
|
||||
logger.info(f"Loading model {config.name} using {model_cls.__name__} to meta device")
|
||||
@@ -297,8 +302,8 @@ def get_model(
|
||||
)
|
||||
logger.debug(f"Loaded model {config.name} in {time.perf_counter() - load_model_start_time:.2f} seconds")
|
||||
|
||||
# For VLM models, freeze the vision encoder
|
||||
if is_vlm:
|
||||
# For VLM training, freeze the vision encoder
|
||||
if is_vlm_training:
|
||||
freeze_vision_encoder(model, override_attr=config.vlm.vision_encoder_attr)
|
||||
|
||||
assert model.lm_head.weight.dtype == dtype, (
|
||||
@@ -337,15 +342,15 @@ def setup_fsdp(model: nn.Module, config: ModelConfig, parallel_dims: ParallelDim
|
||||
|
||||
dp_mod_ep_mesh = parallel_dims.world_mesh[tuple(dp_mod_ep_mesh_dim_names)]
|
||||
|
||||
is_vlm = config.vlm is not None
|
||||
if is_vlm:
|
||||
is_vlm_training = config.vlm is not None
|
||||
if is_vlm_training:
|
||||
vision_encoder = get_vision_encoder(model, override=config.vlm.vision_encoder_attr)
|
||||
if vision_encoder is None:
|
||||
raise ValueError(f"VLM model {config.name} has no recognized vision encoder")
|
||||
fully_shard(vision_encoder, mesh=hsdp_mesh, **fsdp_config)
|
||||
get_logger().info("Applied FSDP to frozen vision encoder")
|
||||
|
||||
language_model = get_language_model(model, override=config.vlm.language_model_attr if is_vlm else None)
|
||||
language_model = get_language_model(model, override=config.vlm.language_model_attr if is_vlm_training else None)
|
||||
transformer_layers = language_model.layers
|
||||
|
||||
for transformer_block in transformer_layers:
|
||||
|
||||
@@ -51,10 +51,13 @@ except ImportError:
|
||||
|
||||
try:
|
||||
from fla.modules import FusedRMSNormGated
|
||||
from fla.ops.cp import FLACPContext, build_cp_context
|
||||
from fla.ops.gated_delta_rule import chunk_gated_delta_rule
|
||||
except ImportError:
|
||||
chunk_gated_delta_rule = None # type: ignore
|
||||
FusedRMSNormGated = None # type: ignore
|
||||
FLACPContext = None # type: ignore
|
||||
build_cp_context = None # type: ignore
|
||||
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
@@ -238,6 +241,20 @@ class Qwen3_5MoeGatedDeltaNet(nn.Module):
|
||||
self._causal_conv1d_fn = causal_conv1d_fn
|
||||
self._chunk_gated_delta_rule = chunk_gated_delta_rule or torch_chunk_gated_delta_rule
|
||||
|
||||
def _build_cp_context(self, local_seq_len: int, device: torch.device) -> "FLACPContext | None":
|
||||
"""Build fla CP context from the local (sharded) sequence length."""
|
||||
cp_group = getattr(self, "cp_group", None)
|
||||
if cp_group is None or build_cp_context is None:
|
||||
return None
|
||||
# Reconstruct global cu_seqlens: single contiguous sequence across all CP ranks
|
||||
global_seq_len = local_seq_len * self.cp_world_size
|
||||
global_cu_seqlens = torch.tensor([0, global_seq_len], dtype=torch.int32, device=device)
|
||||
return build_cp_context(
|
||||
cu_seqlens=global_cu_seqlens,
|
||||
group=cp_group,
|
||||
conv1d_kernel_size=self.conv_kernel_size,
|
||||
)
|
||||
|
||||
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
||||
batch_size, seq_len, _ = hidden_states.shape
|
||||
|
||||
@@ -272,16 +289,31 @@ class Qwen3_5MoeGatedDeltaNet(nn.Module):
|
||||
query = query.repeat_interleave(self.num_v_heads // self.num_k_heads, dim=2)
|
||||
key = key.repeat_interleave(self.num_v_heads // self.num_k_heads, dim=2)
|
||||
|
||||
core_attn_out, _ = self._chunk_gated_delta_rule(
|
||||
query,
|
||||
key,
|
||||
value,
|
||||
g=g,
|
||||
beta=beta,
|
||||
initial_state=None,
|
||||
output_final_state=False,
|
||||
use_qk_l2norm_in_kernel=True,
|
||||
)
|
||||
# Use fla's native CP when available, otherwise fall back to PyTorch kernel
|
||||
cp_context = self._build_cp_context(seq_len, hidden_states.device)
|
||||
if cp_context is not None:
|
||||
cu_seqlens = cp_context.cu_seqlens
|
||||
core_attn_out, _ = self._chunk_gated_delta_rule(
|
||||
query,
|
||||
key,
|
||||
value,
|
||||
g=g,
|
||||
beta=beta,
|
||||
use_qk_l2norm_in_kernel=True,
|
||||
cu_seqlens=cu_seqlens,
|
||||
cp_context=cp_context,
|
||||
)
|
||||
else:
|
||||
core_attn_out, _ = self._chunk_gated_delta_rule(
|
||||
query,
|
||||
key,
|
||||
value,
|
||||
g=g,
|
||||
beta=beta,
|
||||
initial_state=None,
|
||||
output_final_state=False,
|
||||
use_qk_l2norm_in_kernel=True,
|
||||
)
|
||||
|
||||
# Gated RMSNorm
|
||||
core_attn_out = core_attn_out.reshape(-1, self.head_v_dim)
|
||||
|
||||
@@ -176,12 +176,13 @@ def train(config: TrainerConfig):
|
||||
weight_broadcast = setup_weight_broadcast(config.output_dir, config.weight_broadcast, config.model.lora)
|
||||
|
||||
if parallel_dims.cp_enabled:
|
||||
substitute_hf_flash_attn(parallel_dims.world_mesh["cp"].get_group(), heads_k_stride=1)
|
||||
substitute_ring_attn(
|
||||
parallel_dims.world_mesh["cp"].get_group(),
|
||||
heads_k_stride=1,
|
||||
attn_impl=config.model.attn,
|
||||
)
|
||||
cp_group = parallel_dims.world_mesh["cp"].get_group()
|
||||
cp_rank = parallel_dims.world_mesh["cp"].get_local_rank()
|
||||
substitute_hf_flash_attn(cp_group, heads_k_stride=1)
|
||||
substitute_ring_attn(cp_group, heads_k_stride=1, attn_impl=config.model.attn)
|
||||
from prime_rl.utils.cp import setup_hybrid_cp
|
||||
|
||||
setup_hybrid_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
|
||||
# Optionally, resume training from a checkpoint
|
||||
progress = Progress()
|
||||
@@ -361,8 +362,7 @@ def train(config: TrainerConfig):
|
||||
if config.model.lora:
|
||||
lora_num_tokens = micro_batch["lora_num_tokens"].to("cuda")
|
||||
if cp_enabled:
|
||||
chunk_size = input_ids.shape[1] # We pad to multiple of cp so this should be fine
|
||||
logger.debug(f"[Rank {world.rank}] {cp_rank=} {cp_size=} {cp_group=} {chunk_size=}")
|
||||
chunk_size = input_ids.shape[1]
|
||||
# Convert to cumsum, adjust for CP chunk, convert back to num_tokens
|
||||
cu_offsets = lora_num_tokens.cumsum(dim=0, dtype=torch.int32)
|
||||
adjusted_cu = torch.clip(cu_offsets - chunk_size * cp_rank, min=0, max=chunk_size)
|
||||
|
||||
@@ -99,12 +99,11 @@ def train(config: SFTConfig):
|
||||
|
||||
if parallel_dims.cp_enabled:
|
||||
assert config.data.seq_len % parallel_dims.cp == 0, "Sequence length must be divisible by CP degree"
|
||||
substitute_hf_flash_attn(parallel_dims.world_mesh["cp"].get_group(), heads_k_stride=1)
|
||||
substitute_ring_attn(
|
||||
parallel_dims.world_mesh["cp"].get_group(),
|
||||
heads_k_stride=1,
|
||||
attn_impl=config.model.attn,
|
||||
)
|
||||
cp_group = parallel_dims.world_mesh["cp"].get_group()
|
||||
cp_rank = parallel_dims.world_mesh["cp"].get_local_rank()
|
||||
substitute_hf_flash_attn(cp_group, heads_k_stride=1)
|
||||
substitute_ring_attn(cp_group, heads_k_stride=1, attn_impl=config.model.attn)
|
||||
from prime_rl.utils.cp import setup_hybrid_cp
|
||||
|
||||
# Set up checkpoint manager
|
||||
logger.info(f"Initializing checkpoint managers ({config.ckpt})")
|
||||
@@ -124,6 +123,9 @@ def train(config: SFTConfig):
|
||||
config.model, parallel_dims, loading_from_ckpt_later, fused_cross_entropy=config.loss_impl == "liger_fused"
|
||||
)
|
||||
|
||||
if parallel_dims.cp_enabled:
|
||||
setup_hybrid_cp(model, cp_group, cp_rank, parallel_dims.cp)
|
||||
|
||||
if config.model.lora is not None:
|
||||
multi_run_manager = get_multi_run_manager()
|
||||
multi_run_manager.reset_run_parameters(0)
|
||||
|
||||
@@ -139,6 +139,7 @@ def setup_clients(client_config: ClientConfig, client_type: str = "openai_chat_c
|
||||
max_keepalive_connections=8192,
|
||||
max_retries=10,
|
||||
extra_headers=headers,
|
||||
extra_headers_from_state=client_config.extra_headers_from_state,
|
||||
)
|
||||
)
|
||||
client_idx += 1
|
||||
@@ -146,10 +147,13 @@ def setup_clients(client_config: ClientConfig, client_type: str = "openai_chat_c
|
||||
|
||||
|
||||
def setup_admin_clients(client_config: ClientConfig) -> list[AsyncClient]:
|
||||
"""Create a dedicated admin client for weight update operations.
|
||||
"""Create dedicated admin clients for weight update operations.
|
||||
|
||||
Uses a separate connection pool to avoid queueing behind streaming requests.
|
||||
When admin_base_url is set, uses those URLs instead of base_url, allowing
|
||||
weight updates to bypass routers in disaggregated P/D deployments.
|
||||
"""
|
||||
urls = client_config.admin_base_url if client_config.admin_base_url else client_config.base_url
|
||||
|
||||
def _setup_admin_client(base_url: str) -> httpx.AsyncClient:
|
||||
headers = client_config.headers.copy() # avoid mutating config
|
||||
@@ -167,7 +171,7 @@ def setup_admin_clients(client_config: ClientConfig) -> list[AsyncClient]:
|
||||
timeout=httpx.Timeout(None),
|
||||
)
|
||||
|
||||
return [_setup_admin_client(base_url) for base_url in client_config.base_url]
|
||||
return [_setup_admin_client(base_url) for base_url in urls]
|
||||
|
||||
|
||||
async def maybe_check_has_model(
|
||||
@@ -218,6 +222,31 @@ async def check_health(
|
||||
NCCL_READY_MARKER = "NCCL_READY"
|
||||
|
||||
|
||||
async def _pause_engines(admin_clients: list[AsyncClient]) -> None:
|
||||
"""Pause all inference engines, waiting for in-flight requests to drain."""
|
||||
logger = get_logger()
|
||||
logger.info("Pausing inference engines for weight update")
|
||||
|
||||
async def _pause(client: AsyncClient) -> None:
|
||||
response = await client.post("/pause", params={"mode": "keep", "clear_cache": "false"})
|
||||
response.raise_for_status()
|
||||
|
||||
await asyncio.gather(*[_pause(client) for client in admin_clients])
|
||||
logger.info("All inference engines paused")
|
||||
|
||||
|
||||
async def _resume_engines(admin_clients: list[AsyncClient]) -> None:
|
||||
"""Resume all inference engines after weight update."""
|
||||
logger = get_logger()
|
||||
|
||||
async def _resume(client: AsyncClient) -> None:
|
||||
response = await client.post("/resume")
|
||||
response.raise_for_status()
|
||||
|
||||
await asyncio.gather(*[_resume(client) for client in admin_clients])
|
||||
logger.info("All inference engines resumed")
|
||||
|
||||
|
||||
async def update_weights(
|
||||
admin_clients: list[AsyncClient],
|
||||
weight_dir: Path | None,
|
||||
@@ -226,9 +255,9 @@ async def update_weights(
|
||||
) -> None:
|
||||
"""Update weights on static inference servers.
|
||||
|
||||
Creates a NCCL_READY marker file before calling the update endpoint to signal
|
||||
to the trainer that inference workers are about to enter the receive path.
|
||||
This marker is only used in NCCL broadcast mode but is harmless in filesystem mode.
|
||||
Pauses all engines first to drain in-flight requests, then performs the
|
||||
weight update, then resumes. This ensures all DP workers are idle and can
|
||||
participate in the collective weight transfer.
|
||||
|
||||
Note: The server-side /update_weights endpoint automatically resets the prefix cache
|
||||
to invalidate any cached KV states computed with the old weights.
|
||||
@@ -242,23 +271,23 @@ async def update_weights(
|
||||
else:
|
||||
|
||||
async def _update_weights(admin_client: AsyncClient, weight_dir: str | None) -> None:
|
||||
try:
|
||||
response = await admin_client.post("/update_weights", json={"weight_dir": weight_dir})
|
||||
response.raise_for_status()
|
||||
except httpx.HTTPStatusError as e:
|
||||
if e.response.status_code == 404:
|
||||
logger.warning("The route /update_weights does not exist. Skipping weight update.")
|
||||
return
|
||||
raise
|
||||
response = await admin_client.post("/update_weights", json={"weight_dir": weight_dir})
|
||||
response.raise_for_status()
|
||||
|
||||
# Create ready marker before servers enter receive path (used by NCCL broadcast)
|
||||
if weight_dir is not None:
|
||||
nccl_ready_file = weight_dir / NCCL_READY_MARKER
|
||||
nccl_ready_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
nccl_ready_file.touch()
|
||||
logger.debug(f"Created NCCL_READY marker at {nccl_ready_file}")
|
||||
# Pause engines so all DP workers drain in-flight work and can join the NCCL broadcast
|
||||
await _pause_engines(admin_clients)
|
||||
|
||||
await asyncio.gather(*[_update_weights(admin_client, weight_dir_posix) for admin_client in admin_clients])
|
||||
try:
|
||||
# Create ready marker before servers enter receive path (used by NCCL broadcast)
|
||||
if weight_dir is not None:
|
||||
nccl_ready_file = weight_dir / NCCL_READY_MARKER
|
||||
nccl_ready_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
nccl_ready_file.touch()
|
||||
logger.debug(f"Created NCCL_READY marker at {nccl_ready_file}")
|
||||
|
||||
await asyncio.gather(*[_update_weights(admin_client, weight_dir_posix) for admin_client in admin_clients])
|
||||
finally:
|
||||
await _resume_engines(admin_clients)
|
||||
|
||||
|
||||
def _is_retryable_lora_error(exception: BaseException) -> bool:
|
||||
@@ -316,22 +345,40 @@ async def init_nccl_broadcast(
|
||||
host: str,
|
||||
port: int,
|
||||
timeout: int,
|
||||
inference_world_size: int | None = None,
|
||||
quantize_in_weight_transfer: bool = False,
|
||||
) -> None:
|
||||
"""Make a HTTP post request to the vLLM server to initialize the NCCL broadcast."""
|
||||
"""Initialize NCCL broadcast on all inference servers.
|
||||
|
||||
Each admin client represents one vLLM server. The function computes
|
||||
per-server rank_offset and gpus_per_server so that every inference GPU
|
||||
gets a unique rank in the NCCL broadcast group.
|
||||
"""
|
||||
logger = get_logger()
|
||||
|
||||
async def _init_nccl_broadcast(
|
||||
admin_client: AsyncClient, host: str, port: int, client_num: int, timeout: int
|
||||
) -> None:
|
||||
if inference_world_size is None:
|
||||
inference_world_size = len(admin_clients)
|
||||
logger.warning(
|
||||
f"inference_world_size not provided, defaulting to {inference_world_size} (one GPU per admin client)"
|
||||
)
|
||||
|
||||
gpus_per_server = inference_world_size // len(admin_clients)
|
||||
|
||||
logger.info(
|
||||
f"Initializing NCCL broadcast: {len(admin_clients)} servers, "
|
||||
f"inference_world_size={inference_world_size}, gpus_per_server={gpus_per_server}"
|
||||
)
|
||||
|
||||
async def _init_nccl_broadcast(admin_client: AsyncClient, rank_offset: int) -> None:
|
||||
try:
|
||||
response = await admin_client.post(
|
||||
"/init_broadcaster",
|
||||
json={
|
||||
"host": host,
|
||||
"port": port,
|
||||
"server_rank": client_num,
|
||||
"num_inference_server": len(admin_clients),
|
||||
"rank_offset": rank_offset,
|
||||
"inference_world_size": inference_world_size,
|
||||
"gpus_per_server": gpus_per_server,
|
||||
"timeout": timeout,
|
||||
"quantize_in_weight_transfer": quantize_in_weight_transfer,
|
||||
},
|
||||
@@ -344,7 +391,7 @@ async def init_nccl_broadcast(
|
||||
|
||||
await asyncio.gather(
|
||||
*[
|
||||
_init_nccl_broadcast(admin_client, host, port, client_num, timeout)
|
||||
_init_nccl_broadcast(admin_client, client_num * gpus_per_server)
|
||||
for client_num, admin_client in enumerate(admin_clients)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1,8 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import torch
|
||||
import torch.distributed as dist
|
||||
import torch.nn as nn
|
||||
from ring_flash_attn import update_ring_flash_attn_params
|
||||
|
||||
|
||||
def setup_hybrid_cp(model: nn.Module, cp_group: dist.ProcessGroup, cp_rank: int, cp_world_size: int) -> None:
|
||||
"""Configure DeltaNet modules in Qwen3.5 hybrid models for native fla CP."""
|
||||
layers = None
|
||||
if hasattr(model, "model"):
|
||||
inner = model.model
|
||||
if hasattr(inner, "language_model"):
|
||||
inner = inner.language_model
|
||||
if hasattr(inner, "layers"):
|
||||
layers = inner.layers
|
||||
|
||||
if layers is None:
|
||||
return
|
||||
|
||||
count = 0
|
||||
for layer in layers:
|
||||
if getattr(layer, "layer_type", None) == "linear_attention":
|
||||
attn = getattr(layer, "linear_attn", None)
|
||||
if attn is not None:
|
||||
attn.cp_group = cp_group
|
||||
attn.cp_rank = cp_rank
|
||||
attn.cp_world_size = cp_world_size
|
||||
count += 1
|
||||
|
||||
if count > 0:
|
||||
from prime_rl.utils.logger import get_logger
|
||||
|
||||
get_logger().info(f"Configured hybrid CP on {count} DeltaNet modules (fla native state passing)")
|
||||
|
||||
|
||||
def shard_for_cp(t: torch.Tensor, cp_rank: int, cp_world_size: int) -> torch.Tensor:
|
||||
"""
|
||||
Shard a tensor for context parallelism.
|
||||
|
||||
@@ -3,6 +3,7 @@ import functools
|
||||
import importlib
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
@@ -129,10 +130,13 @@ def clean_exit(func: Callable) -> Callable:
|
||||
ret = await func(*args, **kwargs)
|
||||
wandb.finish()
|
||||
return ret
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
get_logger().opt(exception=True).error(f"Fatal error in {func.__name__}")
|
||||
wandb.finish(exit_code=1)
|
||||
raise e
|
||||
# sys.exit raises SystemExit so the finally block still runs.
|
||||
# raise alone doesn't terminate the process in an async context —
|
||||
# the event loop swallows it and the process hangs indefinitely.
|
||||
sys.exit(1)
|
||||
finally:
|
||||
if dist.is_initialized():
|
||||
dist.destroy_process_group()
|
||||
@@ -146,10 +150,11 @@ def clean_exit(func: Callable) -> Callable:
|
||||
ret = func(*args, **kwargs)
|
||||
wandb.finish()
|
||||
return ret
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
get_logger().opt(exception=True).error(f"Fatal error in {func.__name__}")
|
||||
wandb.finish(exit_code=1)
|
||||
raise e
|
||||
# sys.exit raises SystemExit so the finally block still runs.
|
||||
sys.exit(1)
|
||||
finally:
|
||||
if dist.is_initialized():
|
||||
dist.destroy_process_group()
|
||||
|
||||
@@ -34,10 +34,12 @@ def validate_shared_model_name(
|
||||
orchestrator: OrchestratorConfig,
|
||||
inference: Optional[InferenceConfig] = None,
|
||||
) -> None:
|
||||
# Orchestrator must match inference (it queries the inference server)
|
||||
if inference is not None:
|
||||
if inference.model.name != orchestrator.model.name:
|
||||
raise ValueError(
|
||||
f"Inference model name ({inference.model.name}) and orchestrator model name ({orchestrator.model.name}) are not the same. Please specify the same model name for both."
|
||||
f"Inference model name ({inference.model.name}) and orchestrator model name ({orchestrator.model.name}) are not the same. "
|
||||
"The orchestrator queries the inference server and must use the same model name."
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@@ -80,6 +80,11 @@ def get_language_model(model: nn.Module, override: str | None = None) -> nn.Modu
|
||||
return model.model
|
||||
|
||||
|
||||
def is_vlm_architecture(model_config: PretrainedConfig) -> bool:
|
||||
"""Check if the model config belongs to a known VLM architecture."""
|
||||
return _get_model_info_from_config(model_config) is not None
|
||||
|
||||
|
||||
def get_layer_prefix(model_config: PretrainedConfig, override: str | None = None) -> str:
|
||||
"""Return the weight key prefix for language model layers.
|
||||
|
||||
|
||||
@@ -594,11 +594,19 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deep-gemm"
|
||||
version = "2.3.0+35c4bc8"
|
||||
source = { url = "https://github.com/hallerite/DeepGEMM/releases/download/v2.3.0-torch2.9/deep_gemm-2.3.0+35c4bc8-cp312-cp312-linux_x86_64.whl" }
|
||||
name = "deep-ep"
|
||||
version = "1.2.1+73b6ea4"
|
||||
source = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl" }
|
||||
wheels = [
|
||||
{ url = "https://github.com/hallerite/DeepGEMM/releases/download/v2.3.0-torch2.9/deep_gemm-2.3.0+35c4bc8-cp312-cp312-linux_x86_64.whl", hash = "sha256:c8ab813c466c7f4e63e85e39f35386ff8783cea885eadddbc2a7a0baf0240289" },
|
||||
{ url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl", hash = "sha256:ddf25e5d9c8543d27d7ae7a62ff7752560bf79c03c5991d48721352818b320d3" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deep-gemm"
|
||||
version = "2.3.0+477618c"
|
||||
source = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_gemm-2.3.0+477618c-cp312-cp312-linux_x86_64.whl" }
|
||||
wheels = [
|
||||
{ url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_gemm-2.3.0+477618c-cp312-cp312-linux_x86_64.whl", hash = "sha256:a40cea03705cfa50eefe5651d91e3e7ebf87a53acf06cde8bbb877fb95f0f921" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -856,6 +864,16 @@ dependencies = [
|
||||
{ name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flash-linear-attention"
|
||||
version = "0.4.2"
|
||||
source = { git = "https://github.com/fla-org/flash-linear-attention#02af88ef8aa7f7043a899c9ca6fde168e1cf8c7e" }
|
||||
dependencies = [
|
||||
{ name = "einops", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "torch", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "transformers", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flashinfer-python"
|
||||
version = "0.6.4"
|
||||
@@ -1824,6 +1842,54 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/34/6f/5f5a54a1041af945130abdb2b8529cbef0cdcbbf9bcf3f4195378319d29a/ninja-1.13.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b4f2a072db3c0f944c32793e91532d8948d20d9ab83da9c0c7c15b5768072200", size = 581758, upload-time = "2025-08-11T15:10:13.295Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nixl"
|
||||
version = "0.10.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "nixl-cu12", version = "0.10.1", source = { registry = "https://pypi.org/simple" }, marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "nixl-cu12", version = "0.10.1", source = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl" }, marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/bb/a4/10e80e623790d3fb070e966b36bced009419d483c92ae0df6645230f606f/nixl-0.10.1-py3-none-any.whl", hash = "sha256:616465673dae5180d296525a03237af4cd5f2c00c3228d185bc06dbe621509b7", size = 6680, upload-time = "2026-03-03T19:55:44.848Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nixl-cu12"
|
||||
version = "0.10.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'aarch64' and sys_platform == 'linux'",
|
||||
]
|
||||
dependencies = [
|
||||
{ name = "numpy", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
{ name = "torch", marker = "platform_machine == 'aarch64' and sys_platform == 'linux'" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/21/c1f34212a3e612b5c0da389c1aa3557588d9cfc2adf864914b32e270847b/nixl_cu12-0.10.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:b4712c6e0f18f57fee34cd970faac01480f0caf12da33d4a40ef4e9096a4caf7", size = 50227261, upload-time = "2026-03-03T19:55:17.177Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nixl-cu12"
|
||||
version = "0.10.1"
|
||||
source = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl" }
|
||||
resolution-markers = [
|
||||
"platform_machine == 'x86_64' and sys_platform == 'linux'",
|
||||
]
|
||||
dependencies = [
|
||||
{ name = "numpy", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "torch", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl", hash = "sha256:bd01eb9e52f1affee3330062baa2f3bea7d711664f7cb602bf5d3f694daeb796" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "numpy" },
|
||||
{ name = "torch" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodeenv"
|
||||
version = "1.9.1"
|
||||
@@ -2078,7 +2144,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "openai"
|
||||
version = "2.3.0"
|
||||
version = "2.24.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "anyio", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -2090,9 +2156,9 @@ dependencies = [
|
||||
{ name = "tqdm", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "typing-extensions", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/de/90/8f26554d24d63ed4f94d33c24271559863223a67e624f4d2e65ba8e48dca/openai-2.3.0.tar.gz", hash = "sha256:8d213ee5aaf91737faea2d7fc1cd608657a5367a18966372a3756ceaabfbd812", size = 589616, upload-time = "2025-10-10T01:12:50.851Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/55/13/17e87641b89b74552ed408a92b231283786523edddc95f3545809fab673c/openai-2.24.0.tar.gz", hash = "sha256:1e5769f540dbd01cb33bc4716a23e67b9d695161a734aff9c5f925e2bf99a673", size = 658717, upload-time = "2026-02-24T20:02:07.958Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/9c/5b/4be258ff072ed8ee15f6bfd8d5a1a4618aa4704b127c0c5959212ad177d6/openai-2.3.0-py3-none-any.whl", hash = "sha256:a7aa83be6f7b0ab2e4d4d7bcaf36e3d790874c0167380c5d0afd0ed99a86bd7b", size = 999768, upload-time = "2025-10-10T01:12:48.647Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/30/844dc675ee6902579b8eef01ed23917cc9319a1c9c0c14ec6e39340c96d0/openai-2.24.0-py3-none-any.whl", hash = "sha256:fed30480d7d6c884303287bde864980a4b137b60553ffbcf9ab4a233b7a73d94", size = 1120122, upload-time = "2026-02-24T20:02:05.669Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2444,6 +2510,7 @@ dependencies = [
|
||||
{ name = "beartype", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "dion", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "flash-linear-attention", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "jaxtyping", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "liger-kernel", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "loguru", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -2471,6 +2538,13 @@ dependencies = [
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
disagg = [
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "nixl", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "nixl-cu12", version = "0.10.1", source = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl" }, marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
{ name = "vllm-router", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
envs = [
|
||||
{ name = "aime2024", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "aime2025", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -2503,9 +2577,6 @@ dev = [
|
||||
{ name = "pytest", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "ruff", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
fp8-inference = [
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
|
||||
]
|
||||
mamba-ssm = [
|
||||
{ name = "mamba-ssm", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
@@ -2520,10 +2591,13 @@ requires-dist = [
|
||||
{ name = "code-env", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "color-codeword", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "datasets", specifier = ">=4.0.0" },
|
||||
{ name = "deep-ep", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_ep-1.2.1+73b6ea4-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "deep-gemm", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/deep_gemm-2.3.0+477618c-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "dion", git = "https://github.com/samsja/dion.git?rev=d891eeb" },
|
||||
{ name = "flash-attn", marker = "platform_machine == 'x86_64' and extra == 'flash-attn'", url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.7.16/flash_attn-2.8.3+cu128torch2.10-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "flash-attn-3", marker = "platform_machine == 'x86_64' and extra == 'flash-attn-3'", url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.1/flash_attn_3-3.0.0b1-cp39-abi3-linux_x86_64.whl" },
|
||||
{ name = "flash-attn-cute", marker = "extra == 'flash-attn-cute'", git = "https://github.com/Dao-AILab/flash-attention.git?subdirectory=flash_attn%2Fcute&rev=e2743ab5" },
|
||||
{ name = "flash-linear-attention", git = "https://github.com/fla-org/flash-linear-attention" },
|
||||
{ name = "jaxtyping", specifier = ">=0.3.2" },
|
||||
{ name = "liger-kernel", specifier = ">=0.5.10" },
|
||||
{ name = "logic-env", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
@@ -2531,6 +2605,8 @@ requires-dist = [
|
||||
{ name = "math-env", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "math-python", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "math500", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
{ name = "nixl", marker = "extra == 'disagg'" },
|
||||
{ name = "nixl-cu12", marker = "platform_machine == 'x86_64' and extra == 'disagg'", url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.2/nixl_cu12-0.10.1-cp312-cp312-linux_x86_64.whl" },
|
||||
{ name = "numpy", specifier = ">=2.2.6" },
|
||||
{ name = "openai", specifier = ">=1.106.1" },
|
||||
{ name = "prime", specifier = ">=0.5.37" },
|
||||
@@ -2551,12 +2627,13 @@ requires-dist = [
|
||||
{ name = "torchtitan", git = "https://github.com/pytorch/torchtitan?rev=a1fdd7e" },
|
||||
{ name = "transformers", git = "https://github.com/huggingface/transformers.git?rev=5c1c72b" },
|
||||
{ name = "uvloop", specifier = ">=0.21.0" },
|
||||
{ name = "verifiers", git = "https://github.com/PrimeIntellect-ai/verifiers.git?rev=1960e77" },
|
||||
{ name = "verifiers", git = "https://github.com/PrimeIntellect-ai/verifiers.git?rev=f5580acd" },
|
||||
{ name = "vllm", specifier = ">=0.17.0" },
|
||||
{ name = "vllm-router", marker = "extra == 'disagg'", url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.3/vllm_router-0.1.11-cp38-abi3-linux_x86_64.whl" },
|
||||
{ name = "wandb", specifier = ">=0.24.2" },
|
||||
{ name = "wiki-search", marker = "extra == 'envs'", index = "https://hub.primeintellect.ai/primeintellect/simple/" },
|
||||
]
|
||||
provides-extras = ["flash-attn", "flash-attn-3", "flash-attn-cute", "envs"]
|
||||
provides-extras = ["flash-attn", "flash-attn-3", "flash-attn-cute", "envs", "disagg"]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
@@ -2566,7 +2643,6 @@ dev = [
|
||||
{ name = "pytest", specifier = ">=8.4.1" },
|
||||
{ name = "ruff", specifier = ">=0.12.1" },
|
||||
]
|
||||
fp8-inference = [{ name = "deep-gemm", marker = "platform_machine == 'x86_64'", url = "https://github.com/hallerite/DeepGEMM/releases/download/v2.3.0-torch2.9/deep_gemm-2.3.0+35c4bc8-cp312-cp312-linux_x86_64.whl" }]
|
||||
mamba-ssm = [{ name = "mamba-ssm", specifier = ">=2.3.0" }]
|
||||
|
||||
[[package]]
|
||||
@@ -3752,8 +3828,9 @@ wheels = [
|
||||
[[package]]
|
||||
name = "verifiers"
|
||||
version = "0.1.11"
|
||||
source = { git = "https://github.com/PrimeIntellect-ai/verifiers.git?rev=1960e77#1960e77e9df785fb29d7ffdbdf062f5333645fa1" }
|
||||
source = { git = "https://github.com/PrimeIntellect-ai/verifiers.git?rev=f5580acd#f5580acd7dfbea25f370cc8fd3ec0ec2974693c4" }
|
||||
dependencies = [
|
||||
{ name = "aiolimiter", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "anthropic", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "datasets", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "gepa", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
@@ -3869,6 +3946,36 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/25/4f/972726f9a501f01203b5c4796e1932abbe435fae6d7715a4c3f1aad14a58/vllm-0.17.0-cp38-abi3-manylinux_2_31_x86_64.whl", hash = "sha256:0296670a09d392ee43455d9bebf590d05a9bc2ebce5e25e2919222fc815158da", size = 432927988, upload-time = "2026-03-07T03:54:02.312Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vllm-router"
|
||||
version = "0.1.11"
|
||||
source = { url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.3/vllm_router-0.1.11-cp38-abi3-linux_x86_64.whl" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "fastapi", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "orjson", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "requests", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "setproctitle", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
{ name = "uvicorn", marker = "(platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'x86_64' and sys_platform == 'linux')" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://github.com/samsja/flash-attn-builds/releases/download/v0.3/vllm_router-0.1.11-cp38-abi3-linux_x86_64.whl", hash = "sha256:43c96cebde3d59f88c0e84fe735bba5ccb6a308d3305c80ffc3723194a5f7230" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "aiohttp" },
|
||||
{ name = "fastapi" },
|
||||
{ name = "orjson" },
|
||||
{ name = "pytest", marker = "extra == 'dev'", specifier = ">=7.0.0" },
|
||||
{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.21.0" },
|
||||
{ name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.0.0" },
|
||||
{ name = "requests", specifier = ">=2.25.0" },
|
||||
{ name = "setproctitle" },
|
||||
{ name = "uvicorn" },
|
||||
]
|
||||
provides-extras = ["dev"]
|
||||
|
||||
[[package]]
|
||||
name = "wadler-lindig"
|
||||
version = "0.1.7"
|
||||
|
||||
Reference in New Issue
Block a user