Skip to content

Commit 3ec63b3

Browse files
committed
ci: Install flash-attn using the same torch version before reqs
This should help with failures due to mixed C bindings symbols we see in CI. This is modeled from: instructlab/instructlab#3399 In the future, the repo should adopt `scripts/install-ilab-with-cuda.sh` from ilab repo to avoid duplication. Signed-off-by: Ihar Hrachyshka <[email protected]>
1 parent 1448ffb commit 3ec63b3

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

.github/workflows/e2e-nvidia-l4-x1.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,29 @@ jobs:
120120
python3.11 -m pip cache remove llama_cpp_python
121121
122122
pip_install="python3.11 -m pip install -v -c constraints-dev.txt"
123-
CMAKE_ARGS="-DGGML_CUDA=on" $pip_install .
124123
125-
# https://github.com/instructlab/instructlab/issues/1821
126-
# install with Torch and build dependencies installed
124+
pip_install="python3.11 -m pip install -v -c constraints-dev.txt"
125+
126+
# pre-install some build dependencies
127127
$pip_install packaging wheel setuptools-scm
128+
129+
# flash-attn has a bug in the setup.py that causes pip to attempt installing it
130+
# before torch is installed. This is a bug because their setup.py depends on
131+
# importing the module, so it should have been listed in build_requires. Alas!
132+
#
133+
# See: https://github.com/Dao-AILab/flash-attention/pull/958
134+
# Also: https://github.com/instructlab/instructlab/issues/1821
135+
#
136+
# first, pre-install flash-attn build dependencies
137+
$pip_install torch packaging setuptools wheel psutil ninja
138+
139+
# now build flash-attn using the pre-installed build dependencies; this will
140+
# guarantee that the build version of torch will match the runtime version of
141+
# torch; otherwise, all kinds of problems may occur, like missing symbols when
142+
# accessing C extensions and such
143+
$pip_install flash-attn --no-build-isolation
144+
145+
CMAKE_ARGS="-DGGML_CUDA=on" $pip_install .
128146
$pip_install .[cuda] -r requirements-vllm-cuda.txt
129147
130148
- name: Update instructlab-eval library

.github/workflows/e2e-nvidia-l40s-x4.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,27 @@ jobs:
151151
python3.11 -m pip cache remove llama_cpp_python
152152
153153
pip_install="python3.11 -m pip install -v -c constraints-dev.txt"
154-
CMAKE_ARGS="-DGGML_CUDA=on" $pip_install .
155154
156-
# https://github.com/instructlab/instructlab/issues/1821
157-
# install with Torch and build dependencies installed
155+
# pre-install some build dependencies
158156
$pip_install packaging wheel setuptools-scm
157+
158+
# flash-attn has a bug in the setup.py that causes pip to attempt installing it
159+
# before torch is installed. This is a bug because their setup.py depends on
160+
# importing the module, so it should have been listed in build_requires. Alas!
161+
#
162+
# See: https://github.com/Dao-AILab/flash-attention/pull/958
163+
# Also: https://github.com/instructlab/instructlab/issues/1821
164+
#
165+
# first, pre-install flash-attn build dependencies
166+
$pip_install torch packaging setuptools wheel psutil ninja
167+
168+
# now build flash-attn using the pre-installed build dependencies; this will
169+
# guarantee that the build version of torch will match the runtime version of
170+
# torch; otherwise, all kinds of problems may occur, like missing symbols when
171+
# accessing C extensions and such
172+
$pip_install flash-attn --no-build-isolation
173+
174+
CMAKE_ARGS="-DGGML_CUDA=on" $pip_install .
159175
$pip_install .[cuda] -r requirements-vllm-cuda.txt
160176
161177
- name: Update instructlab-eval library

0 commit comments

Comments
 (0)