File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 44# This source code is licensed under the MIT license found in the
55# LICENSE file in the root directory of this source tree.
66
7+ import gpytorch .settings as gp_settings
8+ import linear_operator .settings as linop_settings
79from botorch import (
810 acquisition ,
911 exceptions ,
2426 gen_candidates_torch ,
2527 get_best_candidates ,
2628)
29+ from botorch .logging import logger
2730from botorch .utils import manual_seed
2831
29-
3032try :
3133 from botorch .version import version as __version__
3234except Exception : # pragma: no cover
3335 __version__ = "Unknown" # pragma: no cover
3436
37+ logger .info (
38+ "Turning off `fast_computations` in linear operator and increasing "
39+ "`max_cholesky_size` and `max_eager_kernel_size` to 4096, and "
40+ "`cholesky_max_tries` to 6. The approximate computations available in "
41+ "GPyTorch aim to speed up GP training and inference in large data "
42+ "regime but they are generally not robust enough to be used in a BO-loop. "
43+ "See gpytorch.settings & linear_operator.settings for more details."
44+ )
45+ linop_settings ._fast_covar_root_decomposition ._default = False
46+ linop_settings ._fast_log_prob ._default = False
47+ linop_settings ._fast_solves ._default = False
48+ linop_settings .cholesky_max_tries ._global_value = 6
49+ linop_settings .max_cholesky_size ._global_value = 4096
50+ gp_settings .max_eager_kernel_size ._global_value = 4096
51+
3552
3653__all__ = [
3754 "acquisition" ,
Original file line number Diff line number Diff line change 66
77import warnings
88
9+ import gpytorch .settings as gp_settings
10+ import linear_operator .settings as linop_settings
911from botorch import settings
1012from botorch .exceptions import BotorchWarning
1113from botorch .utils .testing import BotorchTestCase
@@ -46,3 +48,13 @@ def test_debug(self):
4648 with warnings .catch_warnings (record = True ) as ws :
4749 warnings .warn ("test" , BotorchWarning )
4850 self .assertEqual (len (ws ), 0 )
51+
52+
53+ class TestDefaultGPyTorchLinOpSettings (BotorchTestCase ):
54+ def test_default_gpytorch_linop_settings (self ):
55+ self .assertTrue (linop_settings ._fast_covar_root_decomposition .off ())
56+ self .assertTrue (linop_settings ._fast_log_prob .off ())
57+ self .assertTrue (linop_settings ._fast_solves .off ())
58+ self .assertEqual (linop_settings .cholesky_max_tries .value (), 6 )
59+ self .assertEqual (linop_settings .max_cholesky_size .value (), 4096 )
60+ self .assertEqual (gp_settings .max_eager_kernel_size .value (), 4096 )
You can’t perform that action at this time.
0 commit comments