-
Notifications
You must be signed in to change notification settings - Fork 1.3k
322 lines (308 loc) · 13.7 KB
/
nano_unit_tests_pytorch.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: Nano Unit Tests PyTorch
# Cancel previous runs in the PR when you push new commits
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
paths:
- 'python/nano/**'
- '.github/workflows/nano_unit_tests_pytorch.yml'
pull_request:
branches: [ main ]
paths:
- 'python/nano/**'
- '.github/workflows/nano_unit_tests_pytorch.yml'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
nano-unit-test-pytorch:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.8"]
pytorch-version: [
"pytorch_110 neural-compressor==1.13.1 oneccl_bind_pt==1.10",
"pytorch_111 neural-compressor==1.13.1 oneccl_bind_pt==1.11",
"pytorch_112 neural-compressor==1.13.1 oneccl_bind_pt==1.12.100",
"pytorch_113 neural-compressor==2.0 oneccl_bind_pt==1.13",
"pytorch_20 neural-compressor==2.1 oneccl_bind_pt==2.0",
]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools==58.0.4
python -m pip install --upgrade wheel
- name: Run Nano-init test
shell: bash
run: |
$CONDA/bin/conda create -n bigdl-init -y python==3.8.16 setuptools==58.0.4
source $CONDA/bin/activate bigdl-init
$CONDA/bin/conda info
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
fi
source bigdl-nano-init
if [ 0"$LD_PRELOAD" = "0" ]; then
exit 1
else
echo "Set environment variable successfully."
fi
source $CONDA/bin/deactivate
if [ ! 0"$LD_PRELOAD" = "0" ]; then
exit 1
else
echo "Unset environment variable successfully while deactivating conda environment."
fi
source $CONDA/bin/activate bigdl-init
if [ 0"$LD_PRELOAD" = "0" ]; then
exit 1
else
echo "Setup environment variable successfully while activating conda environment."
fi
pip uninstall -y bigdl-nano
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n bigdl-init --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Run PyTorch unit tests
shell: bash
run: |
$CONDA/bin/conda create -n pytorch -y python==3.8.16 setuptools=58.0.4 cryptography==39.0.1
source $CONDA/bin/activate pytorch
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch
pip install pytest six
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
pip install ${requirements[2]} -f https://developer.intel.com/ipex-whl-stable-cpu
fi
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-tests.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n pytorch --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
nano-unit-test-pytorch-deps:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.8"]
pytorch-version: [
"pytorch_110 neural-compressor==1.13.1 oneccl_bind_pt==1.10",
"pytorch_111 neural-compressor==1.13.1 oneccl_bind_pt==1.11",
"pytorch_112 neural-compressor==1.13.1 oneccl_bind_pt==1.12.100",
"pytorch_113 neural-compressor==2.0 oneccl_bind_pt==1.13",
"pytorch_20 neural-compressor==2.1 oneccl_bind_pt==2.0",
]
steps:
- uses: actions/checkout@v3
- name: Run PyTorch unit tests(Ray)
shell: bash
run: |
$CONDA/bin/conda create -n ray-pytorch -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate ray-pytorch
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch
pip install pytest
# fix issue, see https://github.com/intel-analytics/BigDL/blob/main/docs/readthedocs/source/doc/Nano/Overview/known_issues.md#ray-issues
pip install google-api-core==2.8.2
pip install ray[default]==1.11.0 prometheus_client==0.13.0
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
pip install ${requirements[2]} -f https://developer.intel.com/ipex-whl-stable-cpu
fi
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-ray-tests.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n ray-pytorch --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Run PyTorch unit tests (OpenVINO)
shell: bash
run: |
$CONDA/bin/conda create -n openvino-pytorch -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate openvino-pytorch
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch,inference
pip install pytest
pip install diffusers==0.11.1
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
fi
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-openvino-tests.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n openvino-pytorch --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Run PyTorch unit tests (Automl)
shell: bash
run: |
$CONDA/bin/conda create -n nano-automl-pytorch -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate nano-automl-pytorch
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch
pip install pytest
pip install ConfigSpace
pip install 'optuna<=3.1.1'
pip install six
source bigdl-nano-init
bash python/nano/test/run-nano-automl-pytorch-tests.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n nano-automl-pytorch --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Run PyTorch unit tests (INC)
shell: bash
run: |
$CONDA/bin/conda create -n inc-pytorch -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate inc-pytorch
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch
pip install pytest
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
pip install ${requirements[1]}
fi
pip install numpy==1.23.4
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-inc-tests.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n inc-pytorch --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Run PyTorch unit tests (ONNX)
shell: bash
run: |
$CONDA/bin/conda create -n onnx-pytorch -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate onnx-pytorch
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch,inference
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
pip install ${requirements[1]}
fi
pip install pytest
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-onnx-tests.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n onnx-pytorch --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
nano-unit-test-ipex:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.8"]
pytorch-version: [
# The reason why ipex1.10 is not currently supported is that the optimization of ipex1.10
# will change the require_grad attribute of layers, which will make some tests of nano fail.
# The reason why ipex1.11 is not currently supported is that the optimization of ipex
# seems will cause strange behaior of context manager, which will make some tests of nano fail.
"pytorch_112 neural-compressor==1.13.1",
"pytorch_113 neural-compressor==2.0",
"pytorch_20 neural-compressor==2.1",
]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools==58.0.4
python -m pip install --upgrade wheel
- name: Run PyTorch IPEX unit tests
shell: bash
run: |
$CONDA/bin/conda create -n pytorch-ipex -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate pytorch-ipex
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch,inference
pip install pytest
pip install diffusers==0.11.1
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
pip install ${requirements[1]}
fi
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-tests-ipex.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n pytorch-ipex --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
nano-unit-test-optimizer:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.8"]
pytorch-version: [
# The reason why ipex1.10 is not currently supported is that the optimization of ipex1.10
# will change the require_grad attribute of layers, which will make some tests of nano fail.
"pytorch_111 neural-compressor==1.13.1",
"pytorch_112 neural-compressor==1.13.1",
"pytorch_113 neural-compressor==2.0",
"pytorch_20 neural-compressor==2.1",
]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools==58.0.4
python -m pip install --upgrade wheel
- name: Run PyTorch InferenceOptimizer unit tests
shell: bash
run: |
$CONDA/bin/conda create -n pytorch-inf -y python==3.8.16 setuptools=58.0.4
source $CONDA/bin/activate pytorch-inf
$CONDA/bin/conda info
bash python/nano/dev/build_and_install.sh linux default false pytorch,inference
pip install pytest
if [ ! -z "${{matrix.pytorch-version}}" ]; then
requirements=(${{matrix.pytorch-version}})
bash python/nano/dev/build_and_install.sh linux default false ${requirements[0]} -f https://developer.intel.com/ipex-whl-stable-cpu
pip install ${requirements[1]}
fi
source bigdl-nano-init
bash python/nano/test/run-nano-pytorch-tests-optimizer.sh
source $CONDA/bin/deactivate
$CONDA/bin/conda remove -n pytorch-inf --all
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}