Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Website #2653

Open
wants to merge 99 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
13c99fc
[Docusaurus] Upgrade to v2
CristianLara Nov 26, 2024
c0ec5ea
[Docusaurus] Add landing page
CristianLara Nov 26, 2024
cfef395
[Docusaurus] Temporarily disable algolia and google tracking
CristianLara Nov 26, 2024
eb47ddf
[Docusaurus] Update gitignore
CristianLara Nov 26, 2024
2e94b7c
[Docusaurus] Upgrade to v3
CristianLara Nov 26, 2024
c66ba2d
[Docusaurus] Fix typo in CodeBlock
CristianLara Nov 26, 2024
a3695c7
[Docusaurus] Change prism themes
CristianLara Nov 26, 2024
e02a54a
[Docusaurus] Use Tabs component
CristianLara Nov 26, 2024
9c989f3
[Docusaurus] Clean up landing page
CristianLara Nov 26, 2024
923f83f
[Docusaurus] Add footer
CristianLara Nov 26, 2024
f5c1d32
[Algolia] Enable with test project
CristianLara Nov 26, 2024
8f9d043
[Docusaurus] Use KaTeX for math
CristianLara Nov 26, 2024
b2e1c94
[Docusaurus] Update package.json scripts
CristianLara Nov 26, 2024
4f0c73c
Merge pull request #1 from CristianLara/upgrade-docusaurus
CristianLara Nov 26, 2024
8ce96e4
[Docusaurus] Update yarn lock file
CristianLara Nov 26, 2024
1ef37ac
[Actions] Update publish website workflow
CristianLara Nov 26, 2024
70046fc
[Docusaurus] Update baseUrl
CristianLara Nov 26, 2024
2e68102
Merge pull request #2 from CristianLara/gh-actions-configure
CristianLara Nov 26, 2024
f2f0272
[Actions] Fix typo
CristianLara Nov 26, 2024
45dc6f3
[Algolia] site verification
CristianLara Nov 27, 2024
dc5fcf8
Revert "[Algolia] site verification"
CristianLara Nov 27, 2024
256c53f
[Docusaurus] Change github nav item to icon
CristianLara Nov 27, 2024
5853455
[Tutorials] Next within subdirectory
CristianLara Nov 27, 2024
f332c11
[Tutorials] Add mdx conversion script
CristianLara Nov 27, 2024
44e1772
[Tutorials] Move tutorials.json to new website
CristianLara Nov 27, 2024
218a384
[Docusaurus] Use sidebar.js from new website
CristianLara Nov 27, 2024
a0b3eaa
[Tutorials] Properly convert /begin.../end math
CristianLara Nov 27, 2024
d56ab0b
[Tutorials] Handle <br> tags during conversion
CristianLara Nov 27, 2024
5118c53
[Tutorials] Improve math handling during mdx conversion
CristianLara Nov 27, 2024
f16dd2c
[Tutorials] Add overview page
CristianLara Nov 27, 2024
bb22e7f
[Tutorials] Add to docusaurus sidebar
CristianLara Nov 27, 2024
9ae213d
[Tutorials] Fix github/colab links
CristianLara Nov 27, 2024
39208d0
[Docs] Fix build steps order
CristianLara Nov 27, 2024
a7ef982
Merge pull request #3 from CristianLara/convert-tutorials-ipynb-mdx
CristianLara Nov 27, 2024
73b8490
[Tutorials] Add python dependency
CristianLara Nov 27, 2024
02495f2
[Sphinx] Use ReadTheDocs
CristianLara Nov 27, 2024
0c1085b
[Docusaurus] Link to ReadTheDocs for api reference
CristianLara Nov 27, 2024
601f0dd
[Sphinx] Pin version and use RTD theme
CristianLara Nov 27, 2024
aa49f07
[Sphinx] Allow api docs to span full page viewport width
CristianLara Nov 27, 2024
f6e6bdb
[Sphinx] Remove sphinx from build_docs.sh
CristianLara Nov 27, 2024
ee3122c
Merge pull request #4 from CristianLara/read-the-docs
CristianLara Nov 27, 2024
1d71aa9
[Docs] Fix syntax for KaTeX
CristianLara Dec 2, 2024
19ad36c
[Docusaurus] Update API Reference footer link
CristianLara Dec 2, 2024
53829fb
[Docusaurus] Change footer column order
CristianLara Dec 2, 2024
2efca40
[Docusaurus] Update landing page colors
CristianLara Dec 2, 2024
e7201c7
[Docs] Delete docs/README
CristianLara Dec 2, 2024
a1d86f2
[Docusaurus] Add version dropdown to navbar
CristianLara Dec 2, 2024
4868d63
[Docusaurus] Archive link points directory to archived versions page
CristianLara Dec 2, 2024
5400b57
[Tutorials] Install dependencies if in Colab
CristianLara Dec 2, 2024
ee3c241
[Tutorials] Install Ax in tutorials that use it
CristianLara Dec 2, 2024
467af1f
Merge pull request #5 from CristianLara/tutorials-colab-install-deps
CristianLara Dec 2, 2024
5cf3fce
[Tutorials] Clean up github link generation
CristianLara Dec 3, 2024
f63a8e9
[Actions] Create new docusaurus version on releases
CristianLara Dec 3, 2024
d408683
Merge pull request #6 from CristianLara/tutorial-versioning
CristianLara Dec 3, 2024
2f9d682
[Actions] Remove unnecessary step
CristianLara Dec 3, 2024
b176947
[Actions] Only create new website & docs version if major or minor ve…
CristianLara Dec 12, 2024
7dad122
Merge pull request #9 from CristianLara/release-on-major-minor-versions
CristianLara Dec 12, 2024
980868b
[Actions] Fix syntax
CristianLara Dec 12, 2024
4abb608
[Actions] Don't inherit secrets
CristianLara Dec 12, 2024
1eea559
[Actions] Correctly get previous version tag
CristianLara Dec 12, 2024
3cf5588
[Actions] Fetch tags on release
CristianLara Dec 12, 2024
256b054
[Actions] typo
CristianLara Dec 12, 2024
fcfe591
[Actions] Manually force fetch tags
CristianLara Dec 12, 2024
b313a4f
[Actions] checkout exact sha instead of tag ref
CristianLara Dec 12, 2024
bd51a6d
[Actions] Force fetch tags
CristianLara Dec 12, 2024
30900bf
[Actions] Disable fetch depth
CristianLara Dec 12, 2024
7e9b6c8
[Actions] Split up website publish into separate jobs
CristianLara Dec 12, 2024
1b6fb63
Create version v0.13.0 of site in Docusaurus
github-actions[bot] Dec 12, 2024
b83e090
[Docusaurus] Delete old docusaurus website folder
CristianLara Dec 16, 2024
2a7f62a
[Docusaurus] Update website archive link
CristianLara Dec 16, 2024
f32b83b
Lint
CristianLara Dec 16, 2024
0808bda
[Docs] Remove unused files
CristianLara Dec 16, 2024
50d9508
[Actions] Publish website installs relevant deps
CristianLara Dec 16, 2024
6a0c27d
[Tutorials] Lint
CristianLara Dec 16, 2024
9fc8103
[Actions] Install all deps for tutorial conversion
CristianLara Dec 16, 2024
538b207
[Actions] Fix workflow variables
CristianLara Dec 16, 2024
846b3b4
[Actions] Fix typo
CristianLara Dec 16, 2024
8ccbf33
Merge remote-tracking branch 'upstream/main'
CristianLara Dec 16, 2024
09b459d
Create version v0.14.0 of site in Docusaurus
github-actions[bot] Dec 16, 2024
60a95e0
[Actions] Temporarily disable pypi in cron nightly cron
CristianLara Dec 16, 2024
a92fb74
[Tutorials] Search for tutorials in subdirectories
CristianLara Dec 16, 2024
f13759a
flake8
CristianLara Dec 16, 2024
4768614
[Docusaurus] Delete test versions
CristianLara Dec 16, 2024
7226170
[Sphinx] Upgrade sphinx and sphinx-rtd-theme to latest versions
CristianLara Dec 16, 2024
25e09dd
µfmt
CristianLara Dec 16, 2024
020412d
[Actions] Uncomment lines after testing
CristianLara Dec 16, 2024
8f84d61
Merge branch 'main' into main
CristianLara Dec 16, 2024
5a5d432
Update scripts/convert_ipynb_to_mdx.py
CristianLara Dec 16, 2024
3e6d0b6
[Actions] Stop publishing website on every commit
CristianLara Dec 17, 2024
99196eb
[Actions] Deploy website using artifact instead of commit
CristianLara Dec 17, 2024
787c28d
Merge pull request #10 from CristianLara/deploy-website-using-artifact
CristianLara Dec 17, 2024
659379c
[Tutorials] Remove bokeh support from conversion script
CristianLara Dec 17, 2024
48f3757
[Tutorials] Enable plotly support
CristianLara Dec 17, 2024
47a42f2
[Actions] Publish website using release branch
CristianLara Dec 18, 2024
9f818ef
[Docusaurus] Delete versioning files from main
CristianLara Dec 18, 2024
eff8c03
Merge branch 'pytorch:main' into main
CristianLara Jan 10, 2025
39fd6c4
Lint
CristianLara Jan 10, 2025
9315052
Actions: Use python version 3.12
CristianLara Jan 10, 2025
66dbf58
Readthedocs: Build using python v3.12
CristianLara Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions .github/workflows/deploy_on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
run: |
pip install .[test]
Expand All @@ -44,11 +44,40 @@ jobs:
with:
verbose: true

publish-versioned-website:
name: Publish versioned website
check-versions:
needs: package-deploy-pypi
uses: ./.github/workflows/reusable_website.yml
name: Check if major or minor version changed
runs-on: ubuntu-latest
outputs:
major_minor_changed: ${{ steps.compare.outputs.major_minor_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.sha }}
- name: Check if major or minor version changed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would that not be the case? This workflow is executed upon creating a GitHub release, so this should involve updating at least the minor version? Or is the idea that there may be some post-release update bugfix or the like?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also the patch versions. v.. The idea is to not release website for the patch versions (primarily for Ax, since we'll follow semver there after 1.0), since these are not intended to include any new features, but only minimal bug / documentation fixes.

id: compare
run: |
git fetch --tags --force
previous_version=$(git describe --tags --abbrev=0 ${{ github.event.release.tag_name }}^)
prev=$(cut -d '.' -f 1-2 <<< $previous_version) # remove patch number
prev=${prev#v} # remove optional "v" prefix
next=$(cut -d '.' -f 1-2 <<< ${{ github.event.release.tag_name }})
next=${next#v}

echo "Updating from version $previous_version to ${{ github.event.release.tag_name }}"
if [[ "$prev" == "$next" ]]; then
echo "::warning::Major/Minor version was not changed. Skipping website & docs generation step."
else
echo major_minor_changed=true >> $GITHUB_OUTPUT
fi

version-and-publish-website:
needs: check-versions
name: Version and Publish website
if: ${{ needs.check-versions.outputs.major_minor_changed == 'true' }}
uses: ./.github/workflows/publish_website.yml
with:
publish_versioned_website: true
release_tag: ${{ github.event.release.tag_name }}
new_version: ${{ github.event.release.tag_name }}
secrets: inherit
7 changes: 3 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
env:
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install git+https://github.com/cornellius-gp/linear_operator.git
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install .[dev]
pip install beautifulsoup4 ipython nbconvert jinja2
pip install ."[dev, tutorials]"
- name: Validate Sphinx
run: |
python scripts/validate_sphinx.py -p "$(pwd)"
Expand All @@ -38,4 +37,4 @@ jobs:
sphinx-build -WT --keep-going sphinx/source sphinx/build
- name: Validate and parse tutorials
run: |
python scripts/parse_tutorials.py -w "$(pwd)"
python scripts/convert_ipynb_to_mdx.py --clean
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Install dependencies
run: pip install pre-commit
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
env:
ALLOW_LATEST_GPYTORCH_LINOP: true
Expand Down Expand Up @@ -63,9 +63,7 @@ jobs:
publish-latest-website:
name: Publish latest website
needs: [tests-and-coverage-nightly, package-test-deploy-pypi]
uses: ./.github/workflows/reusable_website.yml
with:
publish_versioned_website: false
uses: ./.github/workflows/publish_website.yml
secrets: inherit

run_tutorials:
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/publish_website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish Website

on:
workflow_call:
inputs:
new_version:
required: false
type: string
run_tutorials:
required: false
type: boolean
default: false
workflow_dispatch:


jobs:

build-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 'docusaurus-versions' # release branch
fetch-depth: 0
- name: Sync release branch with main
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git merge origin/main
# To avoid a large number of commits we don't push this sync commit to github until a new release.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- if: ${{ !inputs.new_version }}
name: Install latest GPyTorch and Linear Operator
run: |
pip install git+https://github.com/cornellius-gp/linear_operator.git
pip install git+https://github.com/cornellius-gp/gpytorch.git
- name: Install dependencies
env:
ALLOW_LATEST_GPYTORCH_LINOP: true
ALLOW_BOTORCH_LATEST: true # Allow Ax to install w/ new BoTorch release.
run: |
pip install ."[dev, tutorials]"
# There may not be a compatible Ax pip version, so we use the development version.
pip install git+https://github.com/facebook/Ax.git
- if: ${{ inputs.new_version }}
name: Create new docusaurus version
run: |
python3 scripts/convert_ipynb_to_mdx.py --clean
cd website
yarn
yarn docusaurus docs:version ${{ inputs.new_version }}

git add --all
git commit -m "Create version ${{ inputs.new_version }} of site in Docusaurus"
git push --force origin HEAD:docusaurus-versions
- name: Build website
run: |
bash scripts/build_docs.sh -b
- name: Upload website build as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: website/build/

deploy-website:
needs: build-website
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/reusable_tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- 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
Expand Down
60 changes: 0 additions & 60 deletions .github/workflows/reusable_website.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ sphinx/build/
website/build/
website/i18n/
website/node_modules/
website/.docusaurus/

## Generated for tutorials
website/_tutorials/
website/static/files/
website/pages/tutorials/*
!website/pages/tutorials/index.js
docs/tutorials/*
!docs/tutorials/index.mdx

## Generated for Sphinx
website/pages/api/
website/static/js/*
!website/static/js/mathjax.js
!website/static/js/code_block_buttons.js
website/static/_sphinx-sources/
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "2"

build:
os: "ubuntu-22.04"
tools:
python: "3.12"
jobs:
post_install:
# Install latest botorch if not on a released version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we set ALLOW_LATEST_GPYTORCH_LINOP = true here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sait had the same question 🙂 answered here: #2653 (comment)

The gist is that readthedocs does not have a way for us to programmatically set an env variable to be consumed by the install step in their CI. My solution here was to install pinned deps first then conditionally install the latest versions as a post_install step.

- |
tag=$(eval "git name-rev --name-only --tags HEAD")
if [ $tag = "undefined" ]; then
pip install git+https://github.com/cornellius-gp/linear_operator.git
pip install git+https://github.com/cornellius-gp/gpytorch.git
fi

python:
install:
- method: pip
path: .
extra_requirements:
- dev
saitcakmak marked this conversation as resolved.
Show resolved Hide resolved

sphinx:
configuration: sphinx/source/conf.py
2 changes: 0 additions & 2 deletions docs/README.md

This file was deleted.

30 changes: 18 additions & 12 deletions docs/acquisition.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,27 @@ functions that consider multiple design points jointly (i.e. $q > 1$).
An alternative is to use Monte-Carlo (MC) sampling to approximate the integrals.
An MC approximation of $\alpha$ at $X$ using $N$ MC samples is

$$ \alpha(X) \approx \frac{1}{N} \sum_{i=1}^N a(\xi_{i}) $$
$$
\alpha(X) \approx \frac{1}{N} \sum_{i=1}^N a(\xi_{i})
$$

where $\xi_i \sim \mathbb{P}(f(X) \mid \mathcal{D})$.

For instance, for q-Expected Improvement (qEI), we have:

$$
\text{qEI}(X) \approx \frac{1}{N} \sum_{i=1}^N \max_{j=1,..., q}
\bigl\\{ \max(\xi_{ij} - f^\*, 0) \bigr\\},
\bigl\{ \max(\xi_{ij} - f^*, 0) \bigr\},
\qquad \xi_{i} \sim \mathbb{P}(f(X) \mid \mathcal{D})
$$

where $f^\*$ is the best function value observed so far (assuming noiseless
where $f^*$ is the best function value observed so far (assuming noiseless
observations). Using the reparameterization trick ([^KingmaWelling2014],
[^Rezende2014]),

$$
\text{qEI}(X) \approx \frac{1}{N} \sum_{i=1}^N \max_{j=1,..., q}
\bigl\\{ \max\bigl( \mu(X)\_j + (L(X) \epsilon_i)\_j - f^\*, 0 \bigr) \bigr\\},
\bigl\{ \max\bigl( \mu(X)\_j + (L(X) \epsilon_i)\_j - f^*, 0 \bigr) \bigr\},
\qquad \epsilon_{i} \sim \mathcal{N}(0, I)
$$

Expand All @@ -65,10 +67,10 @@ All MC-based acquisition functions in BoTorch are derived from
[`MCAcquisitionFunction`](../api/acquisition.html#mcacquisitionfunction).

Acquisition functions expect input tensors $X$ of shape
$\textit{batch_shape} \times q \times d$, where $d$ is the dimension of the
$\textit{batch\_shape} \times q \times d$, where $d$ is the dimension of the
feature space, $q$ is the number of points considered jointly, and
$\textit{batch_shape}$ is the batch-shape of the input tensor. The output
$\alpha(X)$ will have shape $\textit{batch_shape}$, with each element
$\textit{batch\_shape}$ is the batch-shape of the input tensor. The output
$\alpha(X)$ will have shape $\textit{batch\_shape}$, with each element
corresponding to the respective $q \times d$ batch tensor in the input $X$.
Note that for analytic acquisition functions, it must be that $q=1$.

Expand Down Expand Up @@ -135,15 +137,19 @@ summary statistics of the posterior distribution at the evaluated point(s).
A popular acquisition function is Expected Improvement of a single point
for a Gaussian posterior, given by

$$ \text{EI}(x) = \mathbb{E}\bigl[
\max(y - f^\*, 0) \mid y\sim \mathcal{N}(\mu(x), \sigma^2(x))
\bigr] $$
$$
\text{EI}(x) = \mathbb{E}\bigl[
\max(y - f^*, 0) \mid y\sim \mathcal{N}(\mu(x), \sigma^2(x))
\bigr]
$$

where $\mu(x)$ and $\sigma(x)$ are the posterior mean and variance of $f$ at the
point $x$, and $f^\*$ is again the best function value observed so far (assuming
point $x$, and $f^*$ is again the best function value observed so far (assuming
noiseless observations). It can be shown that

$$ \text{EI}(x) = \sigma(x) \bigl( z \Phi(z) + \varphi(z) \bigr)$$
$$
\text{EI}(x) = \sigma(x) \bigl( z \Phi(z) + \varphi(z) \bigr)
$$

where $z = \frac{\mu(x) - f_{\max}}{\sigma(x)}$ and $\Phi$ and $\varphi$ are
the cdf and pdf of the standard normal distribution, respectively.
Expand Down
Loading
Loading