-
Notifications
You must be signed in to change notification settings - Fork 401
113 lines (111 loc) · 4.19 KB
/
reusable_tutorials.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
name: Reusable Tutorials Workflow
on:
workflow_dispatch:
inputs:
smoke_test:
required: true
type: boolean
use_stable_pytorch_gpytorch:
required: true
type: boolean
use_stable_ax:
required: true
type: boolean
upload_artifact:
required: true
type: boolean
workflow_call:
inputs:
smoke_test:
required: false
type: boolean
default: true
use_stable_pytorch_gpytorch:
required: false
type: boolean
default: false
use_stable_ax:
required: false
type: boolean
default: false
upload_artifact:
required: false
type: boolean
default: false
jobs:
tutorials:
name: Run tutorials
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Fetch all history for all tags and branches
# We need to do this so setuptools_scm knows how to set the BoTorch version.
run: git fetch --prune --unshallow
- if: ${{ !inputs.use_stable_pytorch_gpytorch }}
name: Install latest PyTorch & GPyTorch
run: |
pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
pip install git+https://github.com/cornellius-gp/linear_operator.git
pip install git+https://github.com/cornellius-gp/gpytorch.git
- if: ${{ inputs.use_stable_pytorch_gpytorch }}
name: Install min required PyTorch, GPyTorch, and linear_operator
run: |
python setup.py egg_info
req_txt="botorch.egg-info/requires.txt"
min_torch_version=$(grep '\btorch[>=]=' ${req_txt} | sed 's/[^0-9.]//g')
min_gpytorch_version=$(grep '\bgpytorch[>=]=' ${req_txt} | sed 's/[^0-9.]//g')
min_linear_operator_version=$(grep '\blinear_operator[>=]=' ${req_txt} | sed 's/[^0-9.]//g')
pip install "torch==${min_torch_version}" "gpytorch==${min_gpytorch_version}" "linear_operator==${min_linear_operator_version}" torchvision
- name: Install BoTorch with tutorials dependencies
env:
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install .[tutorials]
- if: ${{ !inputs.use_stable_ax }}
name: Install latest Ax
env:
# This is so Ax's setup doesn't install a pinned BoTorch version.
ALLOW_BOTORCH_LATEST: true
run: |
pip install git+https://github.com/facebook/Ax.git
- if: ${{ inputs.use_stable_ax }}
name: Install stable Ax
env:
ALLOW_BOTORCH_LATEST: true
run: |
pip install ax-platform --no-binary ax-platform
- if: ${{ inputs.smoke_test }}
name: Run tutorials with smoke test
run: |
python scripts/run_tutorials.py -p "$(pwd)" -s
- if: ${{ !inputs.smoke_test }}
name: Run tutorials without smoke test
run: |
python scripts/run_tutorials.py -p "$(pwd)"
- if: ${{ inputs.upload_artifact }}
name: Upload performance data to artifacts branch
# Sometimes pushing to this branch doesn't work -- fix planned
continue-on-error: true
# 1) Switch to artifacts branch
# 2) Add the new CSV file
# 3) Get .py and .ipynb files needed for analyzing tutorials data from main
# 4) Run `scripts/analyze_tutorials_performance.py` to merge CSVs and
# update notebook
# 5) Commit updated notebook and new CSVs to artifacts branch
run: |
git config user.email "[email protected]"
git config user.name "github-actions"
cp scripts/analyze_tutorials_performance.py analyze_tutorials_performance.py
cp notebooks/tutorials_performance_tracking.ipynb tutorials_performance_tracking.ipynb
git switch artifacts
mv *.csv tutorial_performance_data/
mv tutorials_performance_tracking.ipynb notebooks/
pip install seaborn
python analyze_tutorials_performance.py
git add tutorial_performance_data/*.csv notebooks/tutorials_performance_tracking.ipynb
git commit -a -m "Adding most recent tutorials CSVs and performance analytics notebook"
git push origin artifacts