-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·125 lines (88 loc) · 3.1 KB
/
build.sh
File metadata and controls
executable file
·125 lines (88 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/env bash
set -e # stop on error
ENV_NAME="verl"
PYTHON_VERSION="3.12"
BACKEND=${BACKEND:-"fsdp"} # or "megatron"
# Parse arguments
while [[ "$#" -gt 0 ]]; do
case "$1" in
--megatron)
BACKEND="megatron"
shift
;;
*)
echo "Unknown parameter: $1"
echo "Usage: $0 [--megatron]"
exit 1
;;
esac
done
echo "Using backend: $BACKEND"
echo "========================================"
echo "Initializing Conda"
echo "========================================"
# Load conda properly
if ! command -v conda &> /dev/null; then
echo "Conda not found. Make sure Anaconda/Miniconda is installed."
exit 1
fi
source "$(conda info --base)/etc/profile.d/conda.sh"
echo "========================================"
echo "Creating environment (if not exists)"
echo "========================================"
if ! conda env list | grep -q "^$ENV_NAME "; then
conda create -y -n "$ENV_NAME" python="$PYTHON_VERSION" 2>/dev/null
fi
echo "========================================"
echo "Activating environment"
echo "========================================"
conda activate $ENV_NAME
echo "Using Python:"
which python
python --version
echo "========================================"
echo "Upgrading pip"
echo "========================================"
pip install --upgrade pip setuptools wheel
echo "========================================"
echo "Cloning verl"
echo "========================================"
if [ ! -d "verl" ]; then
git clone --branch main --depth 1 https://github.com/verl-project/verl.git
fi
echo "========================================"
echo "Patching verl schemas"
echo "========================================"
bash training-scripts/patch_update.sh
cd verl
echo "========================================"
echo "Installing inference frameworks"
echo "========================================"
if [ "$BACKEND" == "megatron" ]; then
bash training-scripts/patch_update.sh
echo "Installing Megatron dependencies..."
USE_MEGATRON=1 USE_SGLANG=0 bash scripts/install_vllm_sglang_mcore.sh
echo "========================================"
echo "Installing editable package"
echo "========================================"
pip install vllm==0.17.1
# pip install transformers==5.3.0
# Install Apex for Megatron
git clone https://github.com/NVIDIA/apex.git && \
cd apex && \
MAX_JOB=32 pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
cd ..
else
USE_MEGATRON=0 USE_SGLANG=0 bash scripts/install_vllm_sglang_mcore.sh
echo "========================================"
echo "Installing editable package"
echo "========================================"
# pip install transformers==4.57.6
fi
pip install --no-deps -e .
pip install -r ../requirements.txt
echo "========================================"
echo "Installation Complete"
echo "========================================"
echo "To use later:"
echo "conda activate $ENV_NAME"