Skip to content

Commit 9774176

Browse files
author
Sahran Ashoor
committed
Merge conflict resolution
2 parents a2f2ef5 + 0cb012f commit 9774176

File tree

147 files changed

+9766
-2667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+9766
-2667
lines changed

setup.cfg renamed to .flake8

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ extend-select = D107, D417, D3, D207, D208, D214, D215
1111
max-line-length = 88
1212
exclude =
1313
build, dist, tutorials, website, .eggs
14-
15-
[coverage:report]
16-
omit =
17-
test/*
18-
setup.py

.github/workflows/deploy_on_release.yml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,39 +49,9 @@ jobs:
4949
with:
5050
verbose: true
5151

52-
check-versions:
53-
needs: package-deploy-pypi
54-
name: Check if major or minor version changed
55-
runs-on: ubuntu-latest
56-
outputs:
57-
major_minor_changed: ${{ steps.compare.outputs.major_minor_changed }}
58-
steps:
59-
- uses: actions/checkout@v4
60-
with:
61-
fetch-depth: 0
62-
fetch-tags: true
63-
ref: ${{ github.sha }}
64-
- name: Check if major or minor version changed
65-
id: compare
66-
run: |
67-
git fetch --tags --force
68-
previous_version=$(git describe --tags --abbrev=0 ${{ github.event.release.tag_name }}^)
69-
prev=$(cut -d '.' -f 1-2 <<< $previous_version) # remove patch number
70-
prev=${prev#v} # remove optional "v" prefix
71-
next=$(cut -d '.' -f 1-2 <<< ${{ github.event.release.tag_name }})
72-
next=${next#v}
73-
74-
echo "Updating from version $previous_version to ${{ github.event.release.tag_name }}"
75-
if [[ "$prev" == "$next" ]]; then
76-
echo "::warning::Major/Minor version was not changed. Skipping website & docs generation step."
77-
else
78-
echo major_minor_changed=true >> $GITHUB_OUTPUT
79-
fi
80-
8152
version-and-publish-website:
82-
needs: check-versions
53+
needs: package-deploy-pypi
8354
name: Version and Publish website
84-
if: ${{ needs.check-versions.outputs.major_minor_changed == 'true' }}
8555
uses: ./.github/workflows/publish_website.yml
8656
with:
8757
new_version: ${{ github.event.release.tag_name }}

.github/workflows/publish_website.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ on:
1010
required: false
1111
type: boolean
1212
default: false
13+
dry_run:
14+
required: false
15+
type: boolean
16+
default: false
1317
workflow_dispatch:
18+
run_tutorials:
19+
required: true
20+
type: boolean
21+
default: false
22+
dry_run:
23+
required: true
24+
type: boolean
25+
default: false
1426

1527

1628
jobs:
@@ -50,6 +62,27 @@ jobs:
5062
run: |
5163
uv pip install ."[dev, tutorials]"
5264
- if: ${{ inputs.new_version }}
65+
name: Delete existing similar versions from Docusaurus
66+
run: |
67+
# Delete existing versions for same Major and Minor version numbers.
68+
# We do this to keep only the latest patch for a given major/minor version.
69+
MAJOR_MINOR_VERSION=$(cut -d '.' -f 1-2 <<< ${{ inputs.new_version }}) # remove patch number
70+
MAJOR_MINOR_VERSION=${MAJOR_MINOR_VERSION#v} # remove optional "v" prefix
71+
for dir in website/versioned_docs/version-$MAJOR_MINOR_VERSION.*; do
72+
if [ -d "$dir" ]; then
73+
OLD_VERSION=$(basename "$dir" | sed 's/^version-//') # remove "version-" prefix from the directory name
74+
echo "Deleting older version $OLD_VERSION with the same major and minor version numbers as $NEW_VERSION"
75+
# Delete version from the three locations Docusaurus uses:
76+
# - versioned_docs/version-X.Y.Z/
77+
# - versioned_sidebars/version-X.Y.Z-sidebars.json
78+
# - versions.json
79+
# https://docusaurus.io/docs/versioning#deleting-an-existing-version
80+
rm -rf "$dir"
81+
rm "website/versioned_sidebars/version-$OLD_VERSION-sidebars.json"
82+
sed -i "/\"$OLD_VERSION\"/d" website/versions.json
83+
fi
84+
done
85+
- if: ${{ inputs.new_version && !inputs.dry_run }}
5386
name: Create new docusaurus version
5487
run: |
5588
python3 scripts/convert_ipynb_to_mdx.py --clean
@@ -70,6 +103,7 @@ jobs:
70103
path: website/build/
71104

72105
deploy-website:
106+
if: ${{ !inputs.dry_run }}
73107
needs: build-website
74108
permissions:
75109
pages: write

.github/workflows/test_website.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test Website
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
paths:
9+
- "tutorials/**"
10+
- "notebooks_community/**"
11+
- "docs/**"
12+
- "scripts/**"
13+
- "website/**"
14+
workflow_dispatch:
15+
16+
jobs:
17+
website:
18+
name: Test building website
19+
uses: ./.github/workflows/publish_website.yml
20+
with:
21+
dry_run: true
22+
run_tutorials: false
23+
permissions:
24+
contents: write
25+
pages: write
26+
id-token: write

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ website/static/files/
102102
docs/tutorials/*
103103
!docs/tutorials/index.mdx
104104

105+
# Generated for community noteboooks
106+
docs/notebooks_community/*
107+
!docs/notebooks_community/index.mdx
108+
105109
## Generated for Sphinx
106110
website/pages/api/
107111
website/static/js/*

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ code can be found in the [website](/website/) folder). It is built using
9696
[Sphinx](http://www.sphinx-doc.org), and embedded into the Docusaurus
9797
website. The sphinx .rst source files for this live in
9898
[sphinx/source](/sphinx/source/).
99-
3. The Jupyter notebook tutorials, parsed by `nbconvert`, and embedded into the
99+
3. The Jupyter notebook tutorials, parsed and converted to MDX, and embedded into the
100100
Docusaurus website. These live in [tutorials](/tutorials/).
101101

102102
To build the documentation you will need [Node](https://nodejs.org/en/) >= 8.x
@@ -108,6 +108,8 @@ The following command will both build the docs and serve the site locally:
108108
./scripts/build_docs.sh
109109
```
110110

111+
See the [website/README.md](website/README.md) for more details.
112+
111113
## Pull Requests
112114

113115
We actively welcome your pull requests.

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Reporting and Fixing Security Issues
2+
3+
Please do not open GitHub issues or pull requests - this makes the problem immediately visible to everyone, including malicious actors. Security issues in this open source project can be safely reported via the Meta Bug Bounty program:
4+
5+
https://bugbounty.meta.com/
6+
7+
Meta's security team will triage your report and determine whether or not is it eligible for a bounty under our program.

botorch/acquisition/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
SampleReducingMCAcquisitionFunction,
6565
)
6666
from botorch.acquisition.multi_step_lookahead import qMultiStepLookahead
67+
from botorch.acquisition.multioutput_acquisition import MultiOutputAcquisitionFunction
6768
from botorch.acquisition.objective import (
6869
ConstrainedMCObjective,
6970
GenericMCObjective,
@@ -136,4 +137,5 @@
136137
"ScalarizedPosteriorTransform",
137138
"get_acquisition_function",
138139
"get_acqf_input_constructor",
140+
"MultiOutputAcquisitionFunction",
139141
]

botorch/acquisition/active_learning.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
from botorch.models.model import Model
3232
from botorch.sampling.base import MCSampler
3333
from botorch.sampling.normal import SobolQMCNormalSampler
34-
from botorch.utils.transforms import concatenate_pending_points, t_batch_mode_transform
34+
from botorch.utils.transforms import (
35+
average_over_ensemble_models,
36+
concatenate_pending_points,
37+
t_batch_mode_transform,
38+
)
3539
from torch import Tensor
3640

3741

@@ -88,6 +92,7 @@ def __init__(
8892

8993
@concatenate_pending_points
9094
@t_batch_mode_transform()
95+
@average_over_ensemble_models
9196
def forward(self, X: Tensor) -> Tensor:
9297
# Construct the fantasy model (we actually do not use the full model,
9398
# this is just a convenient way of computing fast posterior covariances
@@ -154,6 +159,7 @@ def __init__(
154159
)
155160

156161
@t_batch_mode_transform()
162+
@average_over_ensemble_models
157163
def forward(self, X: Tensor) -> Tensor:
158164
r"""Evaluate PairwiseMCPosteriorVariance on the candidate set `X`.
159165

botorch/acquisition/analytic.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
phi,
3636
)
3737
from botorch.utils.safe_math import log1mexp, logmeanexp
38-
from botorch.utils.transforms import convert_to_target_pre_hook, t_batch_mode_transform
38+
from botorch.utils.transforms import (
39+
average_over_ensemble_models,
40+
convert_to_target_pre_hook,
41+
t_batch_mode_transform,
42+
)
3943
from gpytorch.likelihoods.gaussian_likelihood import FixedNoiseGaussianLikelihood
4044
from torch import Tensor
4145
from torch.nn.functional import pad
@@ -154,6 +158,7 @@ def __init__(
154158
self.maximize = maximize
155159

156160
@t_batch_mode_transform(expected_q=1)
161+
@average_over_ensemble_models
157162
def forward(self, X: Tensor) -> Tensor:
158163
r"""Evaluate the Log Probability of Improvement on the candidate set X.
159164
@@ -208,6 +213,7 @@ def __init__(
208213
self.maximize = maximize
209214

210215
@t_batch_mode_transform(expected_q=1)
216+
@average_over_ensemble_models
211217
def forward(self, X: Tensor) -> Tensor:
212218
r"""Evaluate the Probability of Improvement on the candidate set X.
213219
@@ -258,6 +264,7 @@ def __init__(
258264
self.register_buffer("best_f", best_f)
259265

260266
@t_batch_mode_transform()
267+
@average_over_ensemble_models
261268
def forward(self, X: Tensor) -> Tensor:
262269
"""Evaluate approximate qPI on the candidate set X.
263270
@@ -334,6 +341,7 @@ def __init__(
334341
self.maximize = maximize
335342

336343
@t_batch_mode_transform(expected_q=1)
344+
@average_over_ensemble_models
337345
def forward(self, X: Tensor) -> Tensor:
338346
r"""Evaluate Expected Improvement on the candidate set X.
339347
@@ -397,6 +405,7 @@ def __init__(
397405
self.maximize = maximize
398406

399407
@t_batch_mode_transform(expected_q=1)
408+
@average_over_ensemble_models
400409
def forward(self, X: Tensor) -> Tensor:
401410
r"""Evaluate logarithm of Expected Improvement on the candidate set X.
402411
@@ -578,6 +587,7 @@ def __init__(
578587
self.register_forward_pre_hook(convert_to_target_pre_hook)
579588

580589
@t_batch_mode_transform(expected_q=1)
590+
@average_over_ensemble_models
581591
def forward(self, X: Tensor) -> Tensor:
582592
r"""Evaluate Constrained Log Expected Improvement on the candidate set X.
583593
@@ -647,6 +657,7 @@ def __init__(
647657
self.register_forward_pre_hook(convert_to_target_pre_hook)
648658

649659
@t_batch_mode_transform(expected_q=1)
660+
@average_over_ensemble_models
650661
def forward(self, X: Tensor) -> Tensor:
651662
r"""Evaluate Constrained Log Probability of Feasibility on the candidate set X.
652663
@@ -722,6 +733,7 @@ def __init__(
722733
self.register_forward_pre_hook(convert_to_target_pre_hook)
723734

724735
@t_batch_mode_transform(expected_q=1)
736+
@average_over_ensemble_models
725737
def forward(self, X: Tensor) -> Tensor:
726738
r"""Evaluate Constrained Expected Improvement on the candidate set X.
727739
@@ -810,6 +822,7 @@ def __init__(
810822
self.best_f, self.maximize = best_f, maximize
811823

812824
@t_batch_mode_transform(expected_q=1)
825+
@average_over_ensemble_models
813826
def forward(self, X: Tensor) -> Tensor:
814827
r"""Evaluate logarithm of the mean Expected Improvement on the candidate set X.
815828
@@ -894,6 +907,7 @@ def __init__(
894907
super().__init__(model=fantasy_model, best_f=best_f, maximize=maximize)
895908

896909
@t_batch_mode_transform(expected_q=1)
910+
@average_over_ensemble_models
897911
def forward(self, X: Tensor) -> Tensor:
898912
r"""Evaluate Expected Improvement on the candidate set X.
899913
@@ -951,6 +965,7 @@ def __init__(
951965
self.maximize = maximize
952966

953967
@t_batch_mode_transform(expected_q=1)
968+
@average_over_ensemble_models
954969
def forward(self, X: Tensor) -> Tensor:
955970
r"""Evaluate the Upper Confidence Bound on the candidate set X.
956971
@@ -1000,6 +1015,7 @@ def __init__(
10001015
self.maximize = maximize
10011016

10021017
@t_batch_mode_transform(expected_q=1)
1018+
@average_over_ensemble_models
10031019
def forward(self, X: Tensor) -> Tensor:
10041020
r"""Evaluate the posterior mean on the candidate set X.
10051021
@@ -1041,6 +1057,7 @@ def __init__(
10411057
self.register_buffer("weights", weights)
10421058

10431059
@t_batch_mode_transform()
1060+
@average_over_ensemble_models
10441061
def forward(self, X: Tensor) -> Tensor:
10451062
r"""Evaluate the scalarized posterior mean on the candidate set X.
10461063
@@ -1108,6 +1125,7 @@ def __init__(
11081125
self.maximize = maximize
11091126

11101127
@t_batch_mode_transform(expected_q=1)
1128+
@average_over_ensemble_models
11111129
def forward(self, X: Tensor) -> Tensor:
11121130
r"""Evaluate the posterior standard deviation on the candidate set X.
11131131

0 commit comments

Comments
 (0)