Skip to content

[Bug] qMultiFidelityLowerBoundMaxValueEntropy not working with fantasization #1978

Open
@fjzzq2002

Description

@fjzzq2002

🐛 Bug

qMultiFidelityLowerBoundMaxValueEntropy seems to break with fantasization. The error seems specific to GIBBON as using qMultiFidelityMaxValueEntropy instead is fine.

To reproduce

I defined a SingleTaskMultiFidelityGP model for a toy multi-fidelity task:

import torch
from botorch.acquisition.max_value_entropy_search import (
    qMultiFidelityLowerBoundMaxValueEntropy,
    qMultiFidelityMaxValueEntropy,
)
from botorch.fit import fit_gpytorch_mll
from botorch.models import SingleTaskMultiFidelityGP
from botorch.optim import optimize_acqf_mixed
from gpytorch.mlls import ExactMarginalLogLikelihood
from botorch.acquisition.utils import project_to_target_fidelity
train_X = torch.rand((10, 3), dtype=torch.double)
train_Y = torch.rand((10, 1), dtype=torch.double)
model = SingleTaskMultiFidelityGP(train_X, train_Y, data_fidelity=-1)
bounds = torch.tensor([[0.0] * 3, [1.0] * 3], dtype=torch.double)

When we evaluate its multi-fidelity GIBBON without fantasization, everything is working fine:

candidate_set = torch.rand(100, bounds.size(1))
candidate_set = bounds[0] + (bounds[1] - bounds[0]) * candidate_set
MF_qGIBBON = qMultiFidelityLowerBoundMaxValueEntropy(model, candidate_set)
mf_gibbon = MF_qGIBBON(train_X[:1])

But when we fantasize it by setting X_pending, evaluation throws an error:

pending_X = torch.rand((5, 3), dtype=torch.double)
MF_qGIBBON.set_X_pending(pending_X)
mf_gibbon = MF_qGIBBON(train_X[:1]) # ERROR!

Stack trace/error message

Traceback (most recent call last):
  File "test.py", line 21, in <module>
    mf_gibbon = MF_qGIBBON(train_X[:1])
  File "lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "lib/python3.10/site-packages/botorch/utils/transforms.py", line 277, in decorated
    output = method(acqf, X, *args, **kwargs)
  File "lib/python3.10/site-packages/botorch/acquisition/max_value_entropy_search.py", line 809, in forward
    ig = self._compute_information_gain(
  File "lib/python3.10/site-packages/botorch/acquisition/max_value_entropy_search.py", line 861, in _compute_information_gain
    return qLowerBoundMaxValueEntropy._compute_information_gain(
  File "lib/python3.10/site-packages/botorch/acquisition/max_value_entropy_search.py", line 586, in _compute_information_gain
    normalized_mvs = (mvs - mean_m) / stdv
RuntimeError: The size of tensor a (10) must match the size of tensor b (16) at non-singleton dimension 1

Expected Behavior

Evaluation runs through correctly.

System information

  • BoTorch Version 0.9.1
  • GPyTorch Version 1.11
  • PyTorch Version 1.13.1+cpu

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions