Skip to content

Commit 6c65fad

Browse files
committed
update requirements and script
1 parent 7a26f8a commit 6c65fad

File tree

2 files changed

+193
-17
lines changed

2 files changed

+193
-17
lines changed

.github/packaging/vllm_reqs_12_8.txt

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
# These requirements were generated by running steps 1-3 of scripts/build_wheels.sh
2-
# then running pip freeze and manually removing the vllm dependency.
3-
# The intention of this file is to use these known requirements for a fixed
4-
# vLLM build to supplement a vLLM install from download.pytorch.org without
5-
# resorting to --extra-index-url https://download.pytorch.org/whl/nightly to find
6-
# vLLM dependencies (as this results in a ResolutionTooDeep error from pip).
7-
# See the file .github/workflows/gpu_test.yaml for an E2E forge installation using this approach.
8-
# TODO: this should be done way less hackily
1+
# This file was generated by running ./scripts/generate_vllm_reqs.sh
92
aiohappyeyeballs==2.6.1
103
aiohttp==3.13.1
114
aiosignal==1.4.0
@@ -33,8 +26,8 @@ dnspython==2.8.0
3326
einops==0.8.1
3427
email-validator==2.3.0
3528
exceptiongroup==1.3.0
36-
fastapi==0.119.0
37-
fastapi-cli==0.0.13
29+
fastapi==0.119.1
30+
fastapi-cli==0.0.14
3831
fastapi-cloud-cli==0.3.1
3932
fastrlock==0.8.3
4033
filelock==3.19.1
@@ -94,7 +87,7 @@ prometheus-fastapi-instrumentator==7.1.0
9487
prometheus_client==0.23.1
9588
propcache==0.4.1
9689
protobuf==6.33.0
97-
psutil==7.1.0
90+
psutil==7.1.1
9891
py-cpuinfo==9.0.0
9992
pybase64==1.4.2
10093
pycountry==24.6.1
@@ -108,9 +101,9 @@ python-json-logger==4.0.0
108101
python-multipart==0.0.20
109102
PyYAML==6.0.3
110103
pyzmq==27.1.0
111-
ray==2.50.0
104+
ray==2.50.1
112105
referencing==0.37.0
113-
regex==2025.9.18
106+
regex==2025.10.23
114107
requests==2.32.5
115108
rich==14.2.0
116109
rich-toolkit==0.15.1
@@ -119,8 +112,8 @@ rpds-py==0.27.1
119112
safetensors==0.6.2
120113
scipy==1.15.3
121114
sentencepiece==0.2.1
122-
sentry-sdk==2.42.0
123-
setuptools-scm==9.2.1
115+
sentry-sdk==2.42.1
116+
setuptools-scm==9.2.2
124117
shellingham==1.5.4
125118
sniffio==1.3.1
126119
soundfile==0.13.1
@@ -134,11 +127,11 @@ torch==2.9.0+cu128
134127
tqdm==4.67.1
135128
transformers==4.57.1
136129
triton==3.5.0
137-
typer==0.19.2
130+
typer==0.20.0
138131
typing-inspection==0.4.2
139132
typing_extensions==4.15.0
140133
urllib3==2.5.0
141-
uvicorn==0.37.0
134+
uvicorn==0.38.0
142135
uvloop==0.22.1
143136
watchfiles==1.1.1
144137
websockets==15.0.1

scripts/generate_vllm_reqs.sh

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
#!/bin/bash
8+
set -euo pipefail
9+
10+
# Colors for output
11+
RED='\033[0;31m'
12+
GREEN='\033[0;32m'
13+
YELLOW='\033[1;33m'
14+
NC='\033[0m'
15+
16+
# Source version configuration
17+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18+
VERSIONS_FILE="$SCRIPT_DIR/../assets/versions.sh"
19+
20+
if [ ! -f "$VERSIONS_FILE" ]; then
21+
echo -e "${RED}[ERROR]${NC} Versions file not found: $VERSIONS_FILE"
22+
exit 1
23+
fi
24+
25+
source "$VERSIONS_FILE"
26+
27+
# Configuration
28+
BUILD_DIR="$HOME/forge-build"
29+
WHEEL_DIR="$(pwd)/assets/wheels"
30+
31+
# Logging functions
32+
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
33+
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
34+
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
35+
36+
37+
# Validation functions
38+
check_conda_env() {
39+
if [ -z "${CONDA_DEFAULT_ENV:-}" ]; then
40+
log_error "Not running in a conda environment"
41+
log_info "Please create and activate your conda environment first:"
42+
log_info " conda create -n forge python=3.10 -y"
43+
log_info " conda activate forge"
44+
exit 1
45+
fi
46+
log_info "Running in conda environment: $CONDA_DEFAULT_ENV"
47+
}
48+
49+
check_command() {
50+
if ! command -v "$1" &> /dev/null; then
51+
log_error "Required command '$1' not found"
52+
exit 1
53+
fi
54+
}
55+
56+
check_sudo() {
57+
if ! sudo -n true 2>/dev/null; then
58+
log_error "This script requires passwordless sudo access"
59+
log_info "Run 'sudo -v' first, or configure passwordless sudo"
60+
exit 1
61+
fi
62+
}
63+
64+
check_disk_space() {
65+
local required_gb=10
66+
local available_gb=$(df ~/ --output=avail -BG | tail -1 | sed 's/G//')
67+
if [ "$available_gb" -lt "$required_gb" ]; then
68+
log_error "Insufficient disk space. Need ${required_gb}GB, have ${available_gb}GB"
69+
exit 1
70+
fi
71+
}
72+
73+
# Main validation
74+
validate_environment() {
75+
log_info "Validating environment..."
76+
77+
check_conda_env
78+
check_command git
79+
check_command curl
80+
check_command python
81+
check_command pip
82+
check_command conda
83+
check_sudo
84+
check_disk_space
85+
86+
# Check if CUDA toolkit will be available
87+
if ! ldconfig -p | grep -q cuda; then
88+
log_warn "CUDA libraries not found in ldconfig. Will attempt to install CUDA toolkit."
89+
fi
90+
91+
log_info "Environment validation passed"
92+
}
93+
94+
# Setup build directory and wheels directory
95+
setup_build_dir() {
96+
log_info "Setting up build directory: $BUILD_DIR"
97+
mkdir -p "$BUILD_DIR"
98+
log_info "Setting up wheels directory: $WHEEL_DIR"
99+
mkdir -p "$WHEEL_DIR"
100+
log_info "Build and wheels directories created"
101+
}
102+
103+
# Setup CUDA environment variables
104+
setup_cuda_env() {
105+
log_info "Setting up CUDA environment..."
106+
107+
export CUDA_VERSION=12.8
108+
export NVCC=/usr/local/cuda-${CUDA_VERSION}/bin/nvcc
109+
export CUDA_NVCC_EXECUTABLE=/usr/local/cuda-${CUDA_VERSION}/bin/nvcc
110+
export CUDA_HOME=/usr/local/cuda-${CUDA_VERSION}
111+
export PATH="${CUDA_HOME}/bin:$PATH"
112+
export CUDA_INCLUDE_DIRS=$CUDA_HOME/include
113+
export CUDA_CUDART_LIBRARY=$CUDA_HOME/lib64/libcudart.so
114+
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/compat:${LD_LIBRARY_PATH:-}
115+
export LIBRARY_PATH=$CUDA_HOME/lib64:${LIBRARY_PATH:-}
116+
117+
# Save to file for persistence
118+
cat > ~/.forge_cuda_env << 'EOF'
119+
export CUDA_VERSION=12.8
120+
export NVCC=/usr/local/cuda-${CUDA_VERSION}/bin/nvcc
121+
export CUDA_NVCC_EXECUTABLE=/usr/local/cuda-${CUDA_VERSION}/bin/nvcc
122+
export CUDA_HOME=/usr/local/cuda-${CUDA_VERSION}
123+
export PATH="${CUDA_HOME}/bin:$PATH"
124+
export CUDA_INCLUDE_DIRS=$CUDA_HOME/include
125+
export CUDA_CUDART_LIBRARY=$CUDA_HOME/lib64/libcudart.so
126+
export LD_LIBRARY_PATH=/usr/local/cuda-12.8/compat:${LD_LIBRARY_PATH:-}
127+
export LIBRARY_PATH=${CUDA_HOME}/lib64:${LIBRARY_PATH:-}
128+
EOF
129+
130+
log_info "CUDA environment configured"
131+
}
132+
133+
# Step 1: Install PyTorch stable
134+
step1_pytorch() {
135+
pip3 install --pre torch==$PYTORCH_VERSION --index-url https://download.pytorch.org/whl/cu128
136+
}
137+
138+
# Step 2: Install CUDA system packages
139+
step2_cuda_packages() {
140+
sudo dnf install -y cuda-toolkit-12-8 cuda-compat-12-8
141+
setup_cuda_env
142+
}
143+
144+
# Step 3: Build vLLM wheel
145+
step3_vllm() {
146+
log_info "Building vLLM from branch: $VLLM_VERSION (from $VERSIONS_FILE)"
147+
cd "$BUILD_DIR"
148+
if [ -d "vllm" ]; then
149+
log_warn "vLLM directory exists, removing..."
150+
rm -rf vllm
151+
fi
152+
153+
git clone https://github.com/vllm-project/vllm.git --branch $VLLM_VERSION
154+
cd "$BUILD_DIR/vllm"
155+
156+
python use_existing_torch.py
157+
pip install -r requirements/build.txt
158+
pip install --no-build-isolation -e .
159+
}
160+
161+
# Main execution
162+
main() {
163+
echo "Forge Wheel Builder"
164+
echo "==================="
165+
echo ""
166+
167+
validate_environment
168+
setup_build_dir
169+
170+
# Install PyTorch, CUDA packages, and vLLM
171+
step1_pytorch
172+
step2_cuda_packages
173+
step3_vllm
174+
175+
# Output requirements to .github/packaging/vllm_reqs_12_8.txt
176+
REQS_FILE="$SCRIPT_DIR/../.github/packaging/vllm_reqs_12_8.txt"
177+
pip freeze | grep -v "vllm*" > $REQS_FILE
178+
sed -i '1i# This file was generated by running ./scripts/generate_vllm_reqs.sh' $REQS_FILE
179+
}
180+
181+
182+
# Run main function
183+
main "$@"

0 commit comments

Comments
 (0)