Skip to content

Commit 38c7817

Browse files
committed
Adjustments to setup.py and README for torch Sobol (#20)
Summary: Pull Request resolved: facebook/Ax#20 Pull Request resolved: #55 Using the torch native SobolEngine makes things a lot simpler for botorch. ax still uses the cython SobolEngine for a lot of things outside torch land. Reviewed By: danielrjiang Differential Revision: D14946543 fbshipit-source-id: b2b0ea09a5ea7dc29ecb2a24e7ecdc279d168943
1 parent 060087a commit 38c7817

File tree

4 files changed

+99
-65
lines changed

4 files changed

+99
-65
lines changed

.travis.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ matrix:
99
- name: "GPyTorch + PyTorch stable (Python 3.6)"
1010
python: "3.6"
1111
install:
12-
- pip install -q cython numpy
13-
# TODO: Remove when locked to upcoming GPyTorch release 0.3.2
14-
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git@8f0d338d42222689f0106f5f29e62ef4777a392f
12+
# TODO: Remove once GPyTorch 0.3.2 is released and marked a dep. of botorch
13+
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git@32911e3b51901917c0f14101972581c1295b5edb
14+
# TODO: Remove once PyTorch 1.1 is released and marked a dep. of botorch
15+
- pip install -q torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
1516
- pip install -q -e .[test]
1617
script:
1718
- pytest -ra --cov=. --cov-report term-missing
@@ -22,19 +23,21 @@ matrix:
2223
python: "3.7"
2324
dist: xenial
2425
install:
25-
- pip install -q cython numpy
26-
# TODO: Remove when locked to upcoming GPyTorch release 0.3.2
27-
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git@8f0d338d42222689f0106f5f29e62ef4777a392f
26+
# TODO: Remove once GPyTorch 0.3.2 is released and marked a dep. of botorch
27+
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git@32911e3b51901917c0f14101972581c1295b5edb
28+
# TODO: Remove once PyTorch 1.1 is released and marked a dep. of botorch
29+
- pip install -q torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
2830
- pip install -q -e .[test]
2931
script:
3032
- pytest -ra --cov=. --cov-report term-missing
3133
# Latest versions
3234
- name: "GPyTorch + PyTorch latest"
3335
python: "3.6"
3436
install:
35-
- pip install -q cython numpy
36-
- pip install -q torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html;
37+
# TODO: Fix gpytorch installation to work with torch nightly in pip,
38+
# so we don't have to reinstall torch nightly after installing stable
3739
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git
40+
- pip install -q torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
3841
- pip install -q -e .[test]
3942
script:
4043
- pytest -ra --cov=. --cov-report term-missing
@@ -57,9 +60,10 @@ matrix:
5760
- name: "Docs: Sphinx (Python 3.6)"
5861
python: "3.6"
5962
install:
60-
- pip install -q cython numpy
61-
# TODO: Remove when locked to upcoming GPyTorch release 0.3.2
62-
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git@8f0d338d42222689f0106f5f29e62ef4777a392f
63+
# TODO: Remove once GPyTorch 0.3.2 is released and marked a dep. of botorch
64+
- pip install -q git+https://github.com/cornellius-gp/gpytorch.git@32911e3b51901917c0f14101972581c1295b5edb
65+
# TODO: Remove once PyTorch 1.1 is released and marked a dep. of botorch
66+
- pip install -q torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
6367
- pip install -q -e .[dev]
6468
script:
6569
# warnings treated as errors

CONTRIBUTING.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
# Contributing to botorch
2-
We want to make contributing to botorch is as easy and transparent as possible.
1+
# Contributing to BoTorch
2+
We want to make contributing to BoTorch is as easy and transparent as possible.
3+
4+
5+
## Development installation
6+
7+
To get the development installation with all the necessary dependencies for
8+
linting, testing, and building the documentation, run the following:
9+
```bash
10+
git clone https://github.com/facebookexternal/botorch.git
11+
cd botorch
12+
pip install -e .[dev]
13+
```
14+
315

416
## Our Development Process
517

618
#### Code Style
719

8-
botorch uses the [black](https://github.com/ambv/black) code formatter to
20+
BoTorch uses the [black](https://github.com/ambv/black) code formatter to
921
enforce a common code style across the code base. black is installed easily via
1022
pip using `pip install black`, and run locally by calling
1123
```bash
@@ -20,7 +32,7 @@ Travis will fail on your PR if it does not adhere to the black formatting style.
2032

2133

2234
#### Type Hints
23-
botorch is fully typed using python 3.6+
35+
BoTorch is fully typed using python 3.6+
2436
[type hints](https://www.python.org/dev/peps/pep-0484/).
2537
We expect any contributions to also use proper type annotations. While we
2638
currently do not enforce full consistency of these in Travis (type checkers can
@@ -40,7 +52,7 @@ python -m unittest
4052

4153
#### Documentation
4254

43-
botorch's website is also open source, and is part of this very repository (the
55+
BoTorch's website is also open source, and is part of this very repository (the
4456
code can be found in the [website](../website/) folder).
4557
It is built using [Docusaurus](https://docusaurus.io/), and consists of three
4658
main elements:
@@ -89,5 +101,5 @@ outlined on that page and do not file a public issue.
89101

90102

91103
## License
92-
By contributing to botorch, you agree that your contributions will be licensed
104+
By contributing to BoTorch, you agree that your contributions will be licensed
93105
under the LICENSE file in the root directory of this source tree.

README.md

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,91 @@
1-
<img width="300" src="./botorch_logo_lockup.svg" alt="BoTorch Logo" />
1+
<a href="https://botorch.org">
2+
<img width="300" src="./botorch_logo_lockup.svg" alt="BoTorch Logo" />
3+
</a>
24

35
[![Build Status](
46
https://travis-ci.com/facebookexternal/botorch.svg?token=esFvpzSw7sLSsfe1PAr1&branch=master
57
)](https://travis-ci.com/facebookexternal/botorch)
68

79

8-
BoTorch is a library for Bayesian Optimization in PyTorch.
10+
BoTorch is a library for Bayesian Optimization built on PyTorch.
911

10-
It is currently an alpha version under active development - be warned!
12+
*BoTorch is currently in alpha and under active development - be warned*!
1113

1214

13-
## Installation
15+
### Why BoTorch
16+
BoTorch
17+
* Provides a modular and easily extensible interface for composing Bayesian
18+
optimization primitives, including probabilistic models, acquisition functions,
19+
and optimizers.
20+
* Harnesses the power of PyTorch, including auto-differentiation, native support
21+
for highly parallelized modern hardware (e.g. GPUs) using device-agnostic code,
22+
and a dynamic computation graph.
23+
* Supports Monte Carlo-based acquisition functions via the
24+
[reparameterization trick](https://arxiv.org/abs/1312.6114), which makes it
25+
straightforward to implement new ideas without having to impose restrictive
26+
assumptions about the underlying model.
27+
* Enables seamless integration with deep and/or convolutional architectures in PyTorch.
28+
* Has first-class support for state-of-the art probabilistic models in
29+
[GPyTorch](http://www.gpytorch.ai/), including support for multi-task Gaussian
30+
Processes (GPs) deep kernel learning, deep GPs, and approximate inference.
1431

15-
##### Setup Requirements (TODO: Remove once we can use torch Sobol)
1632

17-
The following are required to run the setup:
33+
### Target Audience
1834

19-
- Python >= 3.6
20-
- numpy
21-
- cython
35+
The primary audience for hands-on use of BoTorch are researchers and
36+
sophisticated practitioners in Bayesian Optimization and AI.
37+
38+
We recommend using BoTorch as a low-level API for implementing new algorithms
39+
for [Ax](https://github.com/facebook/Ax). Ax has been designed to be
40+
an easy-to-use platform for end-users, which at the same time is flexible enough
41+
for Bayesian Optimization researchers to plug into for handling of feature
42+
transformations, (meta-)data management, storage, etc.
2243

44+
We recommend that end-users who are not actively doing research on Bayesian
45+
Optimization simply use Ax.
2346

24-
##### Installation Requirements
2547

26-
- PyTorch >= 1.0.1
27-
- gpytorch >= 0.3.0
48+
## Installation
49+
50+
#### Installation Requirements
51+
52+
- Python >= 3.6
53+
- PyTorch nightly (**TODO:** peg to PyTorch 1.1 once released)
54+
- gpytorch >= 0.3.1 (**TODO:** peg to GPyTorch 0.3.2 once released)
2855
- scipy
2956

30-
**Important:**
31-
You will want to have you PyTorch build link against **MKL** (the non-optimized
32-
version of botorch can be up to an order of magnitude slower). Setting this up
33-
manually can be tricky - to make sure this works please use the Anaconda
34-
installation instructions on https://pytorch.org/.
57+
**Important note for MacOS users:**
58+
* You will want to make sure your PyTorch build is linked against MKL (the
59+
non-optimized version of BoTorch can be up to an order of magnitude slower in
60+
some settings). Setting this up manually on MacOS can be tricky - to ensure
61+
this works properly please follow the
62+
[PyTorch installation instructions](https://pytorch.org/get-started/locally/).
63+
* If you need CUDA on MacOS, you will need to build PyTorch from source. Please
64+
consult the PyTorch installation instructions above.
3565

3666

37-
### Install botorch
67+
#### Installing BoTorch
3868

39-
To run the botorch setup, you'll need cython (**TODO:** Remove)
69+
The latest release of BoTorch is easily installed using either pip or conda:
4070
```bash
41-
pip install cython
71+
pip install botorch
4272
```
4373

44-
We recommend installing botorch using pip via ssh:
74+
**TODO: Conda install**
75+
76+
77+
If you'd like to try our bleeding edge features (and don't mind running into an
78+
occasional bug here or there), you can install the latest master from GitHub
79+
(this will also require installing the current GPyTorch master)::
80+
```bash
81+
pip install git+https://github.com/cornellius-gp/gpytorch.git
82+
pip install git+https://github.com/facebookexternal/botorch.git
83+
```
84+
85+
86+
#### Installing BoTorch from the private repo **TODO: REMOVE**
87+
88+
BoTorch is easily installed using pip:
4589
```bash
4690
pip install git+ssh://[email protected]/facebookexternal/botorch.git
4791
```
@@ -63,14 +107,9 @@ To customize the installation, you can also run the following instead:
63107

64108

65109

66-
## Installation using conda
67-
68-
**TODO: conda install is unsupported until the repo is public**
69-
70-
71110
## Contributing
72111
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
73112

74113

75114
## License
76-
botorch is MIT licensed, as found in the LICENSE file.
115+
BoTorch is MIT licensed, as found in the LICENSE file.

setup.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import sys
44

55
from setuptools import find_packages, setup
6-
from setuptools.extension import Extension
76

87

98
REQUIRED_MAJOR = 3
@@ -35,20 +34,6 @@ def missing(package_name):
3534
)
3635

3736

38-
# check for numpy (required for building Sobol cython)
39-
try:
40-
import numpy
41-
except ImportError:
42-
missing("numpy")
43-
44-
45-
# check for Cython itself
46-
try:
47-
from Cython.Build import cythonize
48-
except ImportError:
49-
missing("cython")
50-
51-
5237
# error out if setup dependencies not met
5338
if fatals:
5439
sys.exit(
@@ -57,10 +42,6 @@ def missing(package_name):
5742
)
5843

5944

60-
# TODO: Use torch Sobol once torch 1.1 is released
61-
EXTENSIONS = [Extension("botorch.qmc.sobol", ["botorch/qmc/sobol.pyx"])]
62-
63-
6445
TEST_REQUIRES = ["pytest>=3.6", "pytest-cov"]
6546

6647
DEV_REQUIRES = TEST_REQUIRES + ["black", "flake8", "sphinx", "sphinx-autodoc-typehints"]
@@ -83,9 +64,7 @@ def missing(package_name):
8364
python_requires=">=3.6",
8465
setup_requires=["cython", "numpy"],
8566
install_requires=["torch>=1.0.1", "gpytorch>=0.3.1", "scipy"],
86-
include_dirs=[numpy.get_include()],
8767
packages=find_packages(),
88-
ext_modules=cythonize(EXTENSIONS),
8968
extras_require={
9069
"dev": DEV_REQUIRES,
9170
"test": TEST_REQUIRES,

0 commit comments

Comments
 (0)