question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime Error when running multitask bayesian optimization

See original GitHub issue

Hi guys, when running a multitask bayesian optimization I get the following error:

RuntimeError: size is inconsistent with indices: for dim 1, size is 1 but found index 1

This issue looks almost the same as 183. The difference is that I think I have the most up to date release versions of each of the requisite libraries.

Python: 3.8.2
Cuda: cuda_11.1.relgpu_drvr455TC455_06.29190527_0
ax-platform: 0.1.18
torch: 1.7.0+cu110
botorch: 0.3.2
gpytorch: 1.2.1

And here is the full error output:

Traceback (most recent call last):

  File "C:\Source\MultiModeBayesianOptimization.py", line 230, in <module> m = get_MTGP(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\modelbridge\factory.py", line 258, in get_MTGP
    return TorchModelBridge(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\modelbridge\torch.py", line 66, in __init__
    super().__init__(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\modelbridge\base.py", line 159, in __init__
    self._fit(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\modelbridge\torch.py", line 98, in _fit
    super()._fit(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\modelbridge\array.py", line 89, in _fit
    self._model_fit(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\modelbridge\torch.py", line 134, in _model_fit
    self.model.fit(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\models\torch\botorch.py", line 285, in fit
    self.model = self.model_constructor(  # pyre-ignore [28]

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\ax\models\torch\botorch_defaults.py", line 166, in get_and_fit_model
    mll = fit_gpytorch_model(mll, bounds=bounds)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\botorch\fit.py", line 66, in fit_gpytorch_model
    fit_gpytorch_model(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\botorch\fit.py", line 126, in fit_gpytorch_model
    mll, _ = optimizer(mll, track_iterations=False, **kwargs)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\botorch\optim\fit.py", line 239, in fit_gpytorch_scipy
    res = minimize(

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\_minimize.py", line 617, in minimize
    return _minimize_lbfgsb(fun, x0, args, jac, bounds,

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\lbfgsb.py", line 306, in _minimize_lbfgsb
    sf = _prepare_scalar_function(fun, x0, jac=jac, args=args, epsilon=eps,

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\optimize.py", line 261, in _prepare_scalar_function
    sf = ScalarFunction(fun, x0, args, grad, hess,

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 76, in __init__
    self._update_fun()

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 166, in _update_fun
    self._update_fun_impl()

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 73, in update_fun
    self.f = fun_wrapped(self.x)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\_differentiable_functions.py", line 70, in fun_wrapped
    return fun(x, *args)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\optimize.py", line 74, in __call__
    self._compute_if_needed(x, *args)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\scipy\optimize\optimize.py", line 68, in _compute_if_needed
    fg = self.fun(x, *args)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\botorch\optim\utils.py", line 221, in _scipy_objective_and_grad
    raise e  # pragma: nocover

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\botorch\optim\utils.py", line 214, in _scipy_objective_and_grad
    output = mll.model(*train_inputs)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\models\exact_gp.py", line 257, in __call__
    res = super().__call__(*inputs, **kwargs)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\module.py", line 28, in __call__
    outputs = self.forward(*inputs, **kwargs)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\botorch\models\multitask.py", line 166, in forward
    covar = covar_x.mul(covar_i)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\lazy\lazy_tensor.py", line 1162, in mul
    return self._mul_matrix(lazify(other))

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\lazy\lazy_tensor.py", line 506, in _mul_matrix
    return NonLazyTensor(self.evaluate() * other.evaluate())

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\utils\memoize.py", line 59, in g
    return _add_to_cache(self, cache_name, method(self, *args, **kwargs), *args, kwargs_pkl=kwargs_pkl)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\lazy\lazy_tensor.py", line 906, in evaluate
    res = self.matmul(eye)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\lazy\interpolated_lazy_tensor.py", line 402, in matmul
    right_interp_res = left_t_interp(self.right_interp_indices, self.right_interp_values, tensor, base_size)

  File "c:\users\jbweber\appdata\local\virtualenvs\fbax\lib\site-packages\gpytorch\utils\interpolation.py", line 230, in left_t_interp
    summing_matrix = cls(summing_matrix_indices, summing_matrix_values, size)

RuntimeError: size is inconsistent with indices: for dim 1, size is 1 but found index 1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ldworkincommented, Apr 12, 2021

Hi @wuzheng-sjtu , is this error also happening for you during the multitask tutorial? Or if not, can you provide a reproducible example?

0reactions
ldworkincommented, Apr 13, 2021

No worries, that’s great to hear, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-task Bayesian Optimization
This tutorial uses synthetic functions to illustrate Bayesian optimization using a multi-task Gaussian Process in Ax. A typical use case is optimizing an ......
Read more >
Source code for botorch.models.multitask
Bayesian Optimization with High-Dimensional Outputs. ... set(all_tasks): raise RuntimeError("All output tasks must be present in input data.") self.
Read more >
High-Dimensional Bayesian Optimization with Multi ... - arXiv
The error bar shows the best and worst run in five benchmark runs. The higher the IOPS, the better. The figure is cut...
Read more >
Multi-Task Bayesian Optimization - NIPS papers
Bayesian optimization has recently been proposed as a framework for automati- cally tuning the hyperparameters of machine learning models and has been shown....
Read more >
High-dimensional Bayesian optimization using low ...
For meaningful exploration, we solve a constrained optimization problem. Working on a manuscript? Avoid the common mistakes ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found