Skip to content

Commit 48f2047

Browse files
David Erikssonfacebook-github-bot
authored andcommitted
Don't use Pyro jit by default (#1474)
Summary: Pull Request resolved: #1474 X-link: facebook/Ax#1241 We have observed that using jit with Pyro can result in increased memory usage and even memory leaks, so we are disabling it for now. This will make model fitting with NUTS about ~2X slower. Reviewed By: esantorella Differential Revision: D40949763 fbshipit-source-id: a5c6dc772c3000d4ee788a541fe2f7009fe3aafa
1 parent 208470e commit 48f2047

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

botorch/fit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ def fit_fully_bayesian_model_nuts(
366366
num_samples: int = 256,
367367
thinning: int = 16,
368368
disable_progbar: bool = False,
369+
jit_compile: bool = False,
369370
) -> None:
370371
r"""Fit a fully Bayesian model using the No-U-Turn-Sampler (NUTS)
371372
@@ -379,6 +380,9 @@ def fit_fully_bayesian_model_nuts(
379380
thinning: The amount of thinning. Every nth sample is retained.
380381
disable_progbar: A boolean indicating whether to print the progress
381382
bar and diagnostics during MCMC.
383+
jit_compile: Whether to use jit. Using jit may be ~2X faster (rough estimate),
384+
but it will also increase the memory usage and sometimes result in runtime
385+
errors, e.g., https://github.com/pyro-ppl/pyro/issues/3136.
382386
383387
Example:
384388
>>> gp = SaasFullyBayesianSingleTaskGP(train_X, train_Y)
@@ -389,7 +393,7 @@ def fit_fully_bayesian_model_nuts(
389393
# Do inference with NUTS
390394
nuts = NUTS(
391395
model.pyro_model.sample,
392-
jit_compile=True,
396+
jit_compile=jit_compile,
393397
full_mass=True,
394398
ignore_jit_warnings=True,
395399
max_tree_depth=max_tree_depth,

0 commit comments

Comments
 (0)