2024-12-31 11:04:01 +08:00
|
|
|
#!/bin/bash
|
2024-12-01 18:55:26 +08:00
|
|
|
# Install the dependency in CI.
|
2025-03-28 10:34:10 -07:00
|
|
|
set -euxo pipefail
|
2024-10-30 02:49:08 -07:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
IS_BLACKWELL=${IS_BLACKWELL:-0}
|
2025-08-06 21:42:44 +08:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
if [ "$IS_BLACKWELL" = "1" ]; then
|
2025-08-06 21:42:44 +08:00
|
|
|
CU_VERSION="cu129"
|
2025-08-08 19:56:50 -07:00
|
|
|
else
|
|
|
|
|
CU_VERSION="cu126"
|
2025-08-06 21:42:44 +08:00
|
|
|
fi
|
|
|
|
|
|
2025-08-10 23:52:05 -07:00
|
|
|
# Clear torch compilation cache
|
|
|
|
|
python3 -c 'import os, shutil, tempfile, getpass; cache_dir = os.environ.get("TORCHINDUCTOR_CACHE_DIR") or os.path.join(tempfile.gettempdir(), "torchinductor_" + getpass.getuser()); shutil.rmtree(cache_dir, ignore_errors=True)'
|
|
|
|
|
|
2025-05-15 15:29:25 -07:00
|
|
|
# Kill existing processes
|
2024-12-01 18:55:26 +08:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2025-08-10 12:30:06 -07:00
|
|
|
bash "${SCRIPT_DIR}/../killall_sglang.sh"
|
2024-11-30 00:24:30 -08:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
# Install apt packages
|
|
|
|
|
apt install -y git libnuma-dev
|
|
|
|
|
|
|
|
|
|
# Install uv
|
|
|
|
|
if [ "$IS_BLACKWELL" = "1" ]; then
|
|
|
|
|
# The blackwell CI runner has some issues with pip and uv,
|
|
|
|
|
# so we can only use pip with `--break-system-packages`
|
|
|
|
|
PIP_CMD="pip"
|
|
|
|
|
PIP_INSTALL_SUFFIX="--break-system-packages"
|
2025-08-06 21:42:44 +08:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
# Clean up existing installations
|
|
|
|
|
$PIP_CMD uninstall -y flashinfer_python sgl-kernel sglang vllm $PIP_INSTALL_SUFFIX || true
|
|
|
|
|
else
|
|
|
|
|
# In normal cases, we use uv, which is much faster than pip.
|
2025-08-06 15:02:32 -07:00
|
|
|
pip install --upgrade pip
|
2025-08-08 19:56:50 -07:00
|
|
|
pip install uv
|
|
|
|
|
export UV_SYSTEM_PYTHON=true
|
2025-05-11 10:55:06 -07:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
PIP_CMD="uv pip"
|
|
|
|
|
PIP_INSTALL_SUFFIX="--index-strategy unsafe-best-match"
|
|
|
|
|
|
|
|
|
|
# Clean up existing installations
|
|
|
|
|
$PIP_CMD uninstall flashinfer_python sgl-kernel sglang vllm || true
|
|
|
|
|
fi
|
2025-04-03 17:45:05 +08:00
|
|
|
|
|
|
|
|
# Install the main package
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD install -e "python[dev]" --extra-index-url https://download.pytorch.org/whl/${CU_VERSION} $PIP_INSTALL_SUFFIX
|
2025-04-03 17:45:05 +08:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
if [ "$IS_BLACKWELL" = "1" ]; then
|
2025-08-07 17:08:15 +08:00
|
|
|
# TODO auto determine sgl-kernel version
|
|
|
|
|
SGL_KERNEL_VERSION=0.3.2
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD install https://github.com/sgl-project/whl/releases/download/v${SGL_KERNEL_VERSION}/sgl_kernel-${SGL_KERNEL_VERSION}-cp39-abi3-manylinux2014_x86_64.whl --force-reinstall $PIP_INSTALL_SUFFIX
|
2025-08-07 17:08:15 +08:00
|
|
|
fi
|
|
|
|
|
|
2025-06-09 09:22:39 -07:00
|
|
|
# Show current packages
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD list
|
2025-06-09 09:22:39 -07:00
|
|
|
|
2025-04-03 17:45:05 +08:00
|
|
|
# Install additional dependencies
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD install mooncake-transfer-engine==0.3.5 nvidia-cuda-nvrtc-cu12 py-spy huggingface_hub[hf_xet] $PIP_INSTALL_SUFFIX
|
2025-04-25 12:53:53 +05:30
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
if [ "$IS_BLACKWELL" != "1" ]; then
|
2025-08-06 21:42:44 +08:00
|
|
|
# For lmms_evals evaluating MMMU
|
|
|
|
|
git clone --branch v0.3.3 --depth 1 https://github.com/EvolvingLMMs-Lab/lmms-eval.git
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD install -e lmms-eval/ $PIP_INSTALL_SUFFIX
|
2025-05-06 01:32:02 +08:00
|
|
|
|
2025-08-06 21:42:44 +08:00
|
|
|
# Install xformers
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD install xformers --index-url https://download.pytorch.org/whl/${CU_VERSION} --no-deps $PIP_INSTALL_SUFFIX
|
2025-08-06 21:42:44 +08:00
|
|
|
fi
|
2025-06-09 09:22:39 -07:00
|
|
|
|
2025-08-08 19:56:50 -07:00
|
|
|
# Install FlashMLA for attention backend tests
|
|
|
|
|
# $PIP_CMD install git+https://github.com/deepseek-ai/FlashMLA.git $PIP_INSTALL_SUFFIX
|
2025-06-26 16:32:44 +08:00
|
|
|
|
2025-06-09 09:22:39 -07:00
|
|
|
# Show current packages
|
2025-08-08 19:56:50 -07:00
|
|
|
$PIP_CMD list
|
|
|
|
|
|
|
|
|
|
echo "CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-}"
|