Skip to content

Commit

Permalink
Remove SingleTaskGP type hint
Browse files Browse the repository at this point in the history
Due to serialization issues:
python-attrs/cattrs#531
  • Loading branch information
AdrianSosic committed Apr 17, 2024
1 parent d214013 commit dfa97b3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions baybe/surrogates/gaussian_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, ClassVar, Optional
from typing import TYPE_CHECKING, ClassVar

from attr import define, field

Expand All @@ -12,7 +12,6 @@
from baybe.surrogates.base import Surrogate

if TYPE_CHECKING:
from botorch.models import SingleTaskGP
from torch import Tensor


Expand All @@ -31,7 +30,9 @@ class GaussianProcessSurrogate(Surrogate):
kernel: Kernel = field(factory=MaternKernel)
"""The kernel used by the Gaussian Process."""

_model: Optional[SingleTaskGP] = field(init=False, default=None)
# TODO: type should be Optional[botorch.models.SingleTaskGP] but is currently
# omitted due to: https://github.com/python-attrs/cattrs/issues/531
_model = field(init=False, default=None)
"""The actual model."""

def _posterior(self, candidates: Tensor) -> tuple[Tensor, Tensor]:
Expand Down

0 comments on commit dfa97b3

Please sign in to comment.