-
Notifications
You must be signed in to change notification settings - Fork 1.1k
215 lines (195 loc) · 6.44 KB
/
workflow-pr-gate.yml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Pull Request Gate
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
# First Stage =======================================================================
# Linting and basic CPU-based tests
linting-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://black.readthedocs.io/en/stable/integrations/github_actions.html
- uses: psf/black@stable
with:
options: "--diff" # Remove this to start enforcement
linting-mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[all,test]
- name: Run mypy
run: |
python -m mypy guidance
bare-install:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-12]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Minimal install
run: |
pip install -e .
- name: Attempt import
run: |
python -c "import guidance"
basic-tests-linux-python-latest:
uses: ./.github/workflows/action_plain_basic_tests.yml
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
model:
- "transformers_gpt2_cpu"
- "transformers_phi2_cpu"
# - "transformers_mistral_7b_cpu" See Issue 713
- "llamacpp_llama2_7b_cpu"
- "llamacpp_mistral_7b_cpu"
- "transformers_phi3_mini_4k_instruct_cpu"
- "llamacpp_phi3_mini_4k_instruct_cpu"
with:
os: Large_Linux
python-version: "3.12"
model: ${{ matrix.model }}
end-stage-1:
needs:
- linting-black
- linting-mypy
- bare-install
- basic-tests-linux-python-latest
name: End Stage 1
runs-on: ubuntu-latest
steps:
- run: echo "End of Stage 1"
# Second stage =======================================================================
# Remaining CPU-based tests on Linux, plus server tests and basic GPU testing
basic-tests-gpu-python-latest:
needs: end-stage-1
uses: ./.github/workflows/action_gpu_basic_tests.yml
with:
os: gpu-runner
python-version: "3.12"
basic-tests-linux-python-other:
needs: end-stage-1
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
python-version: ["3.9", "3.10", "3.11"]
model:
- "transformers_gpt2_cpu"
- "transformers_phi2_cpu"
# - "transformers_mistral_7b_cpu" See Issue 713
- "llamacpp_llama2_7b_cpu"
- "llamacpp_mistral_7b_cpu"
- "transformers_phi3_mini_4k_instruct_cpu"
- "llamacpp_phi3_mini_4k_instruct_cpu"
uses: ./.github/workflows/action_plain_basic_tests.yml
with:
os: Large_Linux
python-version: ${{ matrix.python-version }}
model: ${{ matrix.model }}
server-tests:
needs: end-stage-1
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
# Need to figure out what happened to 3.12
python-version: ["3.9", "3.10", "3.11", "3.12"]
uses: ./.github/workflows/action_server_tests.yml
with:
os: ubuntu-latest
python-version: ${{ matrix.python-version }}
end-stage-2:
needs:
- basic-tests-linux-python-other
- basic-tests-gpu-python-latest
- server-tests
name: End Stage 2
runs-on: ubuntu-latest
steps:
- run: echo "End of Stage 1"
# Third Stage ==============================================================
# Windows and MacOS, plus other GPU Linux tests
basic-tests-mac-x86:
needs: end-stage-2
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
model:
- "transformers_gpt2_cpu"
- "transformers_phi2_cpu"
# - "transformers_mistral_7b_cpu" See Issue 713
- "llamacpp_llama2_7b_cpu"
- "llamacpp_mistral_7b_cpu"
# - "transformers_phi3_mini_4k_instruct_cpu" Gives trouble on MacOS
- "llamacpp_phi3_mini_4k_instruct_cpu"
uses: ./.github/workflows/action_plain_basic_tests.yml
with:
os: macos-12
python-version: ${{ matrix.python-version }}
model: ${{ matrix.model }}
basic-tests-mac-arm:
needs: end-stage-2
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
model:
# - "transformers_gpt2_cpu" See #965
# - "transformers_phi2_cpu" Seems to get stuck
# - "transformers_mistral_7b_cpu" See Issue 713
# - "llamacpp_llama2_7b_cpu" Getting stuck with llama-cpp-python 0.2.77
# - "llamacpp_mistral_7b_cpu"
# - "transformers_phi3_mini_4k_instruct_cpu" Gives trouble on MacOS
- "llamacpp_phi3_mini_4k_instruct_cpu"
uses: ./.github/workflows/action_plain_basic_tests.yml
with:
os: macos-latest
python-version: ${{ matrix.python-version }}
model: ${{ matrix.model }}
basic-tests-win:
needs: end-stage-2
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
model:
- "transformers_gpt2_cpu"
- "transformers_phi2_cpu"
# - "transformers_mistral_7b_cpu" See Issue 713
- "llamacpp_llama2_7b_cpu"
- "llamacpp_mistral_7b_cpu"
- "transformers_phi3_mini_4k_instruct_cpu"
- "llamacpp_phi3_mini_4k_instruct_cpu"
uses: ./.github/workflows/action_plain_basic_tests.yml
with:
os: Large_Windows
python-version: ${{ matrix.python-version }}
model: ${{ matrix.model }}
basic-tests-gpu-python-others:
needs: end-stage-2
strategy:
fail-fast: false # Don't cancel all on first failure
matrix:
python-version: ["3.9", "3.10", "3.11"]
uses: ./.github/workflows/action_gpu_basic_tests.yml
with:
os: gpu-runner
python-version: ${{ matrix.python-version }}