This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (92 loc) · 3.26 KB
/
examples.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
name: examples
on:
schedule:
- cron: '0 15 * * *'
jobs:
examples:
# TODO (crcrpar): Run on 3.9.
# ref: https://github.com/optuna/optuna/issues/2034
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
if: github.repository == 'optuna/optuna'
steps:
- uses: actions/checkout@v2
- name: setup-python${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup cache
uses: actions/cache@v2
env:
cache-name: daily-example
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/setup.py') }}-v1
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('**/setup.py') }}
- name: Install (apt)
run: |
sudo apt-get update
sudo apt-get -y install openmpi-bin libopenmpi-dev
- name: Install (Python)
run: |
python -m pip install --upgrade pip
pip install --progress-bar off -U setuptools
python setup.py sdist
# Install minimal dependencies and confirm that `import optuna` is successful.
pip install --progress-bar off $(ls dist/*.tar.gz)
python -c 'import optuna'
# Install all dependencies needed for examples.
pip install --progress-bar off $(ls dist/*.tar.gz)[example] -f https://download.pytorch.org/whl/torch_stable.html
# TODO (crcrpar): Allow fastaiv2 example once https://forums.fast.ai/t/ganlearner-error-no-implementation-found-on-types-that-implement-invisibletensor/83451/7 gets resolved.
- name: Run examples
run: |
if [ ${{ matrix.python-version }} = 3.6 ]; then
IGNORES='chainermn_.*|fastai*|rapids_.*|botorch_.*'
elif [ ${{ matrix.python-version }} = 3.8 ]; then
IGNORES='chainermn_.*|dask_ml_.*|keras_.*|tensorboard_.*|tensorflow_.*|tfkeras_.*|fastai*|rapids_.*'
else
IGNORES='chainermn_.*|fastai*|rapids_.*'
fi
for file in `find examples -name '*.py' -not -name '*_distributed.py' | grep -vE "$IGNORES"`
do
echo $file
python $file > /dev/null
if grep -e '\-\-pruning' $file > /dev/null; then
echo $file --pruning
python $file --pruning > /dev/null
fi
done
env:
OMP_NUM_THREADS: 1
- name: Run Jupyter notebook examples
run: |
for file in `find examples -name '*.ipynb'`
do
echo $file
pytest --nbval-lax $file > /dev/null
done
env:
OMP_NUM_THREADS: 1
- name: Run multi-node examples
run: |
STORAGE_URL=sqlite:///example.db
for file in `find examples -name 'chainermn_*.py'`
do
echo $file
STUDY_NAME=`optuna create-study --storage $STORAGE_URL`
mpirun -n 2 -- python $file $STUDY_NAME $STORAGE_URL > /dev/null
done
env:
OMP_NUM_THREADS: 1
- name: Run Hydra examples
run: |
for file in `find examples/hydra -name '*.py'`
do
echo $file
python $file --multirun > /dev/null
done
env:
OMP_NUM_THREADS: 1