Skip to content

Commit

Permalink
Add non-abstract poll_exception method to MyRunner in custom botorch …
Browse files Browse the repository at this point in the history
…model tutorial (#2087)

Summary:
## Motivation

[Ax https://github.com/pytorch/botorch/issues/1958](https://github.com/facebook/Ax/pull/1958) broke the custom botorch model tutorial by adding an abstract method to the `Runner` class; the tutorial contained a `Runner` subclass that did not override this method. I fixed this by adding a method that returns a `NotImplementedError`.

Pull Request resolved: #2087

Test Plan: Ran tutorial locally: `python scripts/run_tutorials.py -p "$(pwd)" -s -n custom_botorch_model_in_ax.ipynb`

Reviewed By: saitcakmak

Differential Revision: D51046160

Pulled By: esantorella

fbshipit-source-id: dd3b86f379f44be51fda01cbc412559a1e84b475
  • Loading branch information
esantorella authored and facebook-github-bot committed Nov 6, 2023
1 parent 7d90433 commit 64d0c67
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tutorials/custom_botorch_model_in_ax.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
"from typing import Optional\n",
"\n",
"from botorch.models.gpytorch import GPyTorchModel\n",
"from botorch.utils.datasets import SupervisedDataset\n",
"from gpytorch.distributions import MultivariateNormal\n",
"from gpytorch.kernels import RBFKernel, ScaleKernel\n",
"from gpytorch.likelihoods import GaussianLikelihood\n",
Expand Down Expand Up @@ -1140,6 +1139,15 @@
" trial_metadata = {\"name\": str(trial.index)}\n",
" return trial_metadata\n",
"\n",
" def poll_exception(self, trial) -> str:\n",
" \"\"\"\n",
" Returns the exception from a trial if present. In this case, we do not\n",
" expect that trials will have attached exceptions.\n",
" \"\"\"\n",
" raise NotImplementedError(\n",
" f\"{self.__class__.__name__} does not implement a `poll_exception` method.\"\n",
" )\n",
"\n",
"\n",
"exp = Experiment(\n",
" name=\"branin_experiment\",\n",
Expand Down

0 comments on commit 64d0c67

Please sign in to comment.