-
Notifications
You must be signed in to change notification settings - Fork 401
84 lines (82 loc) · 2.89 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
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
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
jobs:
tutorials:
name: Run tutorials
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- 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 --index-url https://download.pytorch.org/whl/nightly/cpu
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 "numpy<2" # Numpy >2.0 is not compatible with PyTorch <2.2.
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)"