forked from facebookresearch/ParlAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
484 lines (448 loc) · 15.2 KB
/
config.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
version: 2.1
# -------------------------------------------------------------------------------------
# environments where we run our jobs
# -------------------------------------------------------------------------------------
executors:
standard_cpu38:
docker:
- image: cimg/python:3.8.0
environment:
PYTHONUNBUFFERED: 1
resource_class: xlarge
small_cpu38:
docker:
- image: cimg/python:3.8.0
environment:
PYTHONUNBUFFERED: 1
resource_class: medium
small_cpu38_conda:
docker:
- image: continuumio/miniconda3
environment:
PYTHONUNBUFFERED: 1
resource_class: medium
osx_cpu38:
macos:
# https://circleci.com/docs/2.0/testing-ios/
xcode: "12.5.1"
environment:
PYTHON: 3.8.0
PYTHONUNBUFFERED: 1
HOMEBREW_NO_AUTO_UPDATE: 1
resource_class: macos.x86.medium.gen2
gpu_small:
environment:
CUDA_VERSION: "11.2"
PYTHONUNBUFFERED: 1
CUDA_HOME: /usr/local/cuda-11.2
machine:
image: ubuntu-2004-cuda-11.2:202103-01
resource_class: gpu.nvidia.small.multi
gpu_medium:
environment:
CUDA_VERSION: "11.2"
PYTHONUNBUFFERED: 1
CUDA_HOME: /usr/local/cuda-11.2
machine:
image: ubuntu-2004-cuda-11.2:202103-01
resource_class: gpu.nvidia.medium.multi
# -------------------------------------------------------------------------------------
# reusable commands
# -------------------------------------------------------------------------------------
commands:
fixgit:
# circleci sets main to the tip of the branch, which isn't super useful for us.
# better if main looks like it would on our local machines
description: Fixes git
steps:
- run:
name: Fixes git
command: |
( [[ "$CIRCLE_BRANCH" != "main" ]] && git branch -f main origin/main ) || true
setup:
description: Sets up the virtual environment
steps:
- run:
name: Sets up the virtual environment
command: |
mkdir -p ~/venv
virtualenv --python=python3 ~/venv
echo ". ~/venv/bin/activate" >> $BASH_ENV
. ~/venv/bin/activate
python --version
setup_conda:
description: Sets up the virtual environment
steps:
- run:
name: Sets up the virtual environment
command: |
echo "Started creating the ParlAI conda environment."
conda create --quiet --yes --name conda_parlai python=3.8
echo "Created the ParlAI conda environment."
conda init bash
source ~/.bashrc
conda deactivate
echo "Activating the ParlAI conda environment."
conda activate conda_parlai
for package in pytorch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 pytorch-cuda=11.6
do
echo "Conda installing ${package}."
conda install --quiet --yes "${package}" -c pytorch -c nvidia
done
echo "conda activate conda_parlai" >> $BASH_ENV
codecov:
description: Coverage report
steps:
- run:
name: Coverage report
when: always
command: |
python -m codecov --flags $CIRCLE_JOB
mkdir -p ~/ParlAI/data
installdeps:
description: Install basic dependencies
steps:
- run:
name: Installs basic dependencies
command: |
pip install --upgrade pip
for i in $(seq 1 3); do python -m pip install --progress-bar off pip setuptools && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -m pip install --progress-bar off coverage && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -m pip install --progress-bar off codecov && s=0 && break || s=$? && sleep 10; done; (exit $s)
mkdir -p ~/ParlAI/test-results
for i in $(seq 1 3); do pip install -v -r requirements.txt && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python setup.py develop && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -c "import nltk; nltk.download('punkt')" && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -c "import nltk; nltk.download('stopwords')" && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -c "import nltk; nltk.download('omw-1.4')" && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -m pip install --progress-bar off spacy && s=0 && break || s=$? && sleep 10; done; (exit $s)
for i in $(seq 1 3); do python -m spacy download en_core_web_sm && s=0 && break || s=$? && sleep 10; done; (exit $s)
installtorchgpu:
description: Install torch GPU and dependencies
steps:
- run:
name: Install torch GPU and dependencies
command: |
python -m pip install --progress-bar off torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1
python -m pip install --progress-bar off 'fairscale~=0.4.0'
python -m pip install --progress-bar off pytorch-pretrained-bert
python -m pip install --progress-bar off 'transformers==4.20'
python -m pip install --progress-bar off 'fairseq==0.10.0'
python -m pip install --progress-bar off 'faiss-gpu==1.7.0'
python -m pip uninstall dataclasses -y
python -c 'import torch; print("Torch version:", torch.__version__)'
python -m torch.utils.collect_env
python -c 'import torch; print("Torch version:", torch.__version__)'
python -m torch.utils.collect_env
installtorchcpuosx:
description: Install torch CPU and dependencies
steps:
- run:
name: Install torch CPU and dependencies
command: |
python -m pip install --progress-bar off 'transformers==4.20'
python -m pip install --progress-bar off 'torch==1.13.1'
python -c 'import torch; print("Torch version:", torch.__version__)'
python -m torch.utils.collect_env
installtorchcpu:
description: Install torch CPU and dependencies
steps:
- run:
name: Install torch CPU and dependencies
command: |
python -m pip install --progress-bar off 'torch==1.13.1' 'torchvision==0.14.1' 'torchaudio==0.13.1'
python -m pip install --progress-bar off 'transformers==4.20'
python -c 'import torch; print("Torch version:", torch.__version__)'
python -m torch.utils.collect_env
installcrowdsourcingdeps:
description: Install Mephisto
steps:
- run:
name: Install Mephisto
command: |
cd ..
git clone [email protected]:facebookresearch/Mephisto.git Mephisto
cd Mephisto; git checkout v1.0.3 -b stable
pip install -e .
# `echo` so that ENTER will be pressed at the prompt
echo | mephisto check
installchecklist:
description: Install checklist and dependencies
steps:
- run:
name: Install checklist and dependencies
command: |
for i in $(seq 1 3); do python -m pip install --progress-bar off checklist && s=0 && break || s=$? && sleep 10; done; (exit $s)
setupcuda:
description: Setup CUDA
steps:
- run:
name: Setup CUDA
working_directory: ~/
command: |
pyenv versions
nvidia-smi
pyenv global 3.9.2
findtests:
description: Find tests to run
parameters:
marker:
type: string
steps:
- run:
working_directory: ~/ParlAI
name: Find tests to run
command: |
set +o pipefail
mkdir -p ~/ParlAI/data/models
python -m pytest -m << parameters.marker >> --collect-only | grep '<' | sed "s/^ *//" | grep -v ':'> teststorun.txt
cat teststorun.txt
runtests:
description: Run a full suite of unit tests
parameters:
cachename:
description: the key for our caches. date and checksum will be added
type: string
marker:
description: the pytest marker to filter on
type: string
more_installs:
description: Any extra installation commands to run
type: steps
default: []
install_cuda:
description: Should we install cuda?
type: boolean
default: false
pytest_flags:
description: extra flags to pass to pytest
type: string
default: "-v"
steps:
- checkout
- when:
condition: << parameters.install_cuda >>
steps:
- setupcuda
- fixgit
- restore_cache:
key: deps-20230404-<< parameters.cachename >>-{{ checksum "requirements.txt" }}
- setup
- installdeps
- << parameters.more_installs >>
- save_cache:
key: deps-20230404-<< parameters.cachename >>-{{ checksum "requirements.txt" }}
paths:
- "~/venv/bin"
- "~/venv/lib"
- findtests:
marker: << parameters.marker >>
- restore_cache:
key: data-20230404-<< parameters.cachename >>-{{ checksum "teststorun.txt" }}
- run:
name: Run tests
no_output_timeout: 60m
command: |
coverage run -m pytest -m << parameters.marker >> << parameters.pytest_flags >> --junitxml=test-results/junit.xml
- save_cache:
key: data-20230404-<< parameters.cachename >>-{{ checksum "teststorun.txt" }}
paths:
- "~/ParlAI/data"
- codecov
- store_test_results:
path: test-results
website:
description: Build (and possibly deploy) the website
parameters:
deploy:
type: boolean
default: false
steps:
- checkout
- fixgit
- restore_cache:
key: deps-20230404-bw-{{ checksum "requirements.txt" }}
- setup
- installdeps
- save_cache:
key: deps-20230404-bw-{{ checksum "requirements.txt" }}
paths:
- "~/venv/bin"
- "~/venv/lib"
- run:
working_directory: ~/ParlAI/website
name: build the website
command: make
- run:
name: zip up the website
working_directory: ~/ParlAI/website/build/
command: |
zip -r ~/ParlAI/website.zip *
- store_artifacts:
path: website.zip
- run:
name: check for bad links
working_directory: ~/ParlAI/
command: |
pip install linkchecker
python -m http.server --directory website/build >/dev/null &
linkchecker http://localhost:8000/
kill %1
- when:
condition: << parameters.deploy >>
steps:
- run:
working_directory: ~/ParlAI/
name: Upload the website
command: |
pip install s3cmd
s3cmd --access_key="${S3_ACCESS_KEY}" --secret_key="${S3_SECRET_KEY}" sync -f --delete-removed website/build/ "s3://parl.ai/"
s3cmd --access_key="${S3_ACCESS_KEY}" --secret_key="${S3_SECRET_KEY}" setacl --acl-public --recursive "s3://parl.ai/"
s3cmd --access_key="${S3_ACCESS_KEY}" --secret_key="${S3_SECRET_KEY}" modify --add-header="Content-type:text/css" 's3://parl.ai/static/css/*' 's3://parl.ai/docs/_static/*.css' 's3://parl.ai/docs/_static/css/*.css'
# -------------------------------------------------------------------------------------
# Actual jobs
# -------------------------------------------------------------------------------------
jobs:
cleaninstall_38:
executor: small_cpu38
working_directory: ~/ParlAI
parallelism: 1
steps:
- checkout
- fixgit
- setup
- run:
name: Test installation instructions
no_output_timeout: 60m
command: |
python -m pip install --progress-bar off --upgrade pip
python -m pip install --progress-bar off pip setuptools
python setup.py develop
parlai display_data -t integration_tests
unittests_osx:
executor: osx_cpu38
working_directory: ~/ParlAI
parallelism: 2
steps:
- runtests:
cachename: osx
marker: unit
unittests_38:
executor: standard_cpu38
working_directory: ~/ParlAI
parallelism: 2
steps:
- runtests:
more_installs:
- installtorchcpu
cachename: ut38
marker: unit
unittests_gpu18:
executor: gpu_small
working_directory: ~/ParlAI
parallelism: 8
steps:
- runtests:
more_installs:
- installtorchgpu
install_cuda: true
cachename: gpu18
marker: unit
long_gpu_tests:
executor: gpu_medium
working_directory: ~/ParlAI
parallelism: 32
steps:
- runtests:
more_installs:
- installtorchgpu
install_cuda: true
cachename: nightly
marker: nightly_gpu
pytest_flags: -v -s
crowdsourcing_tests:
executor: small_cpu38
working_directory: ~/ParlAI
parallelism: 1
steps:
- runtests:
cachename: crowdsourcing
marker: crowdsourcing
more_installs:
- installtorchgpu
- installcrowdsourcingdeps
teacher_tests:
executor: standard_cpu38
working_directory: ~/ParlAI
parallelism: 16
steps:
- runtests:
more_installs:
- installtorchcpu
- installchecklist
cachename: teacher
marker: teacher
pytest_flags: -v -s
build_website:
executor: small_cpu38
working_directory: ~/ParlAI
parallelism: 1
steps:
- website:
deploy: false
deploy_website:
executor: small_cpu38
working_directory: ~/ParlAI
steps:
- website:
deploy: true
test_website:
executor: small_cpu38
working_directory: ~/ParlAI
steps:
- run:
name: Test the website
command: |
echo 'Testing root page:'
curl -f -i 'https://parl.ai/'
echo
echo 'Testing root css:'
curl -f -i 'https://parl.ai/static/css/parlai.css'
echo
echo 'Testing docs page'
curl -f -i 'https://parl.ai/docs/'
echo
echo 'Testing docs css'
curl -f -i 'https://parl.ai/docs/_static/css/parlai_theme.css'
workflows:
version: 2
commit:
jobs:
- cleaninstall_38
- unittests_gpu18:
requires:
- unittests_38
- unittests_osx:
requires:
- unittests_38
- unittests_38
- long_gpu_tests:
requires:
- unittests_38
- crowdsourcing_tests:
requires:
- unittests_38
- teacher_tests:
requires:
- unittests_38
- build_website:
filters:
branches:
ignore: main
- deploy_website:
filters:
branches:
only: main
- test_website:
requires:
- deploy_website