Skip to content

Commit 89c4683

Browse files
authored
Merge pull request #266 from booxter/constraints
ci: Constrain all python dependencies
2 parents e372ed7 + 8d2e895 commit 89c4683

13 files changed

Lines changed: 378 additions & 105 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Update constraints-dev.txt
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 1' # Every Monday at 03:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-constraints:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Checkout "update-constraints" in-house CI action
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
repository: instructlab/ci-actions
23+
path: ci-actions
24+
# no tag that includes https://github.com/instructlab/ci-actions/pull/26, yet
25+
ref: 88641ccaf122964eacdc1a82b18bda369b6f99bd # main
26+
sparse-checkout: |
27+
actions/update-constraints
28+
29+
- name: Update constraints
30+
id: update-constraints
31+
uses: ./ci-actions/actions/update-constraints
32+
with:
33+
gh-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

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

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
- '**.py'
1919
- 'pyproject.toml'
2020
- 'requirements**.txt'
21+
- 'constraints-dev.txt'
2122
- '.github/workflows/e2e-nvidia-l4-x1.yml' # This workflow
2223
workflow_dispatch:
2324

@@ -112,45 +113,29 @@ jobs:
112113
- name: Install ilab
113114
working-directory: ./instructlab
114115
run: |
115-
export CUDA_HOME="/usr/local/cuda"
116-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64"
117-
export PATH="$PATH:$CUDA_HOME/bin"
118-
python3.11 -m venv --upgrade-deps venv
119-
. venv/bin/activate
120-
nvidia-smi
121-
python3.11 -m pip cache remove llama_cpp_python
122-
123-
pip_install="python3.11 -m pip install -v -c constraints-dev.txt"
124-
125-
pip_install="python3.11 -m pip install -v -c constraints-dev.txt"
126-
127-
# pre-install some build dependencies
128-
$pip_install packaging wheel setuptools-scm
129-
130-
# flash-attn has a bug in the setup.py that causes pip to attempt installing it
131-
# before torch is installed. This is a bug because their setup.py depends on
132-
# importing the module, so it should have been listed in build_requires. Alas!
133-
#
134-
# See: https://github.com/Dao-AILab/flash-attention/pull/958
135-
# Also: https://github.com/instructlab/instructlab/issues/1821
136-
#
137-
# first, pre-install flash-attn build dependencies
138-
$pip_install torch packaging setuptools wheel psutil ninja
139-
140-
# now build flash-attn using the pre-installed build dependencies; this will
141-
# guarantee that the build version of torch will match the runtime version of
142-
# torch; otherwise, all kinds of problems may occur, like missing symbols when
143-
# accessing C extensions and such
144-
$pip_install flash-attn --no-build-isolation
145-
146-
CMAKE_ARGS="-DGGML_CUDA=on" $pip_install .
147-
$pip_install .[cuda] -r requirements-vllm-cuda.txt
116+
PYTHON=python3.11 ./scripts/install-ilab-with-cuda.sh
148117
149118
- name: Update instructlab-eval library
150119
working-directory: ./eval
151120
run: |
152121
. ../instructlab/venv/bin/activate
153-
pip install -v .
122+
# Patch out our own pin from the ilab repo constraints file
123+
ilab_constraints=../instructlab/constraints-dev.txt
124+
sed -i '/instructlab-eval==/d' $ilab_constraints
125+
126+
# Since we reuse the virtual environment prepared using ilab
127+
# constraints, we should stick to the same constraints when
128+
# installing latest eval.
129+
#
130+
# FIX: this is not ideal; a proper fix would require decoupling the
131+
# two repos in CI: either by removing the job completely and relying
132+
# on "sdk" (no ilab) test runs; or by preparing a separate
133+
# constraints file that would consider both the requirements files
134+
# for the eval library AND for the ilab - so that they are
135+
# consistent.
136+
pip_install="pip install -c $ilab_constraints"
137+
$pip_install .
138+
$pip_install .[cuda]
154139
155140
- name: Run e2e test
156141
working-directory: ./instructlab

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

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -142,44 +142,29 @@ jobs:
142142
- name: Install ilab
143143
working-directory: ./instructlab
144144
run: |
145-
export CUDA_HOME="/usr/local/cuda"
146-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64"
147-
export PATH="$PATH:$CUDA_HOME/bin"
148-
python3.11 -m venv --upgrade-deps venv
149-
. venv/bin/activate
150-
nvidia-smi
151-
python3.11 -m pip cache remove llama_cpp_python
152-
153-
pip_install="python3.11 -m pip install -v -c constraints-dev.txt"
154-
155-
# pre-install some build dependencies
156-
$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 .
175-
$pip_install .[cuda] -r requirements-vllm-cuda.txt
145+
PYTHON=python3.11 ./scripts/install-ilab-with-cuda.sh
176146
177147
- name: Update instructlab-eval library
178148
working-directory: ./eval
179149
run: |
180150
. ../instructlab/venv/bin/activate
181-
pip install .
182-
pip install .[cuda]
151+
# Patch out our own pin from the ilab repo constraints file
152+
ilab_constraints=../instructlab/constraints-dev.txt
153+
sed -i '/instructlab-eval==/d' $ilab_constraints
154+
155+
# Since we reuse the virtual environment prepared using ilab
156+
# constraints, we should stick to the same constraints when
157+
# installing latest eval.
158+
#
159+
# FIX: this is not ideal; a proper fix would require decoupling the
160+
# two repos in CI: either by removing the job completely and relying
161+
# on "sdk" (no ilab) test runs; or by preparing a separate
162+
# constraints file that would consider both the requirements files
163+
# for the eval library AND for the ilab - so that they are
164+
# consistent.
165+
pip_install="pip install -c $ilab_constraints"
166+
$pip_install .
167+
$pip_install .[cuda]
183168
184169
- name: Check disk before tests
185170
run: |

.github/workflows/lint.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- '**.py'
1212
- 'pyproject.toml'
1313
- 'requirements*.txt'
14+
- 'constraints-dev.txt'
1415
- 'tox.ini'
1516
- '.pylintrc'
1617
- 'scripts/*.sh' # Used by this workflow
@@ -23,6 +24,7 @@ on:
2324
- '**.py'
2425
- 'pyproject.toml'
2526
- 'requirements*.txt'
27+
- 'constraints-dev.txt'
2628
- 'tox.ini'
2729
- '.pylintrc'
2830
- 'scripts/*.sh' # Used by this workflow
@@ -82,8 +84,9 @@ jobs:
8284
8385
- name: Install tox
8486
run: |
85-
python -m pip install --upgrade pip
86-
python -m pip install tox tox-gh
87+
pip_install="python -m pip install -c constraints-dev.txt"
88+
$pip_install --upgrade pip
89+
$pip_install tox tox-gh
8790
8891
- name: "${{ matrix.lint.name }}"
8992
run: |

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- '**.py'
1313
- 'pyproject.toml'
1414
- 'requirements**.txt'
15+
- 'constraints-dev.txt'
1516
- 'tox.ini'
1617
- 'scripts/*.sh' # Used by this workflow
1718
- '.github/workflows/test.yml' # This workflow
@@ -23,6 +24,7 @@ on:
2324
- '**.py'
2425
- 'pyproject.toml'
2526
- 'requirements**.txt'
27+
- 'constraints-dev.txt'
2628
- 'tox.ini'
2729
- 'scripts/*.sh' # Used by this workflow
2830
- '.github/workflows/test.yml' # This workflow
@@ -99,8 +101,9 @@ jobs:
99101

100102
- name: Install dependencies
101103
run: |
102-
python -m pip install --upgrade pip
103-
python -m pip install tox tox-gh>=1.2
104+
pip_install="python -m pip install -c constraints-dev.txt"
105+
$pip_install --upgrade pip
106+
$pip_install tox tox-gh>=1.2
104107
105108
- name: Run unit and functional tests with tox
106109
run: |

0 commit comments

Comments
 (0)