From 64d0c6785f739541e8190ad28927f52ba63df021 Mon Sep 17 00:00:00 2001 From: Elizabeth Santorella Date: Mon, 6 Nov 2023 14:44:42 -0800 Subject: [PATCH] Add non-abstract poll_exception method to MyRunner in custom botorch 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: https://github.com/pytorch/botorch/pull/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 --- tutorials/custom_botorch_model_in_ax.ipynb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tutorials/custom_botorch_model_in_ax.ipynb b/tutorials/custom_botorch_model_in_ax.ipynb index d2d68d7f39..0a31d621e0 100644 --- a/tutorials/custom_botorch_model_in_ax.ipynb +++ b/tutorials/custom_botorch_model_in_ax.ipynb @@ -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", @@ -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",