Skip to content

Commit 531b5ca

Browse files
saitcakmakfacebook-github-bot
authored andcommitted
Remove Standardize.load_state_dict
Summary: This was a temporary wrokaround for backwards. compatibility, added in #1875 Reviewed By: Balandat Differential Revision: D56801096
1 parent 8906470 commit 531b5ca

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

botorch/models/transforms/outcome.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,6 @@ def __init__(
256256
self._batch_shape = batch_shape
257257
self._min_stdv = min_stdv
258258

259-
def load_state_dict(
260-
self, state_dict: Mapping[str, Any], strict: bool = True
261-
) -> None:
262-
r"""Custom logic for loading the state dict."""
263-
if "_is_trained" not in state_dict:
264-
warnings.warn(
265-
"Key '_is_trained' not found in state_dict. Setting to True. "
266-
"In a future release, this will result in an error.",
267-
DeprecationWarning,
268-
)
269-
state_dict = {**state_dict, "_is_trained": torch.tensor(True)}
270-
super().load_state_dict(state_dict, strict=strict)
271-
272259
def forward(
273260
self, Y: Tensor, Yvar: Optional[Tensor] = None
274261
) -> Tuple[Tensor, Optional[Tensor]]:

test/models/transforms/test_outcome.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,6 @@ def test_standardize_state_dict(self):
355355
self.assertFalse(new_transform._is_trained)
356356
new_transform.load_state_dict(state_dict)
357357
self.assertTrue(new_transform._is_trained)
358-
# test deprecation error when loading state dict without _is_trained
359-
state_dict.pop("_is_trained")
360-
with self.assertWarnsRegex(
361-
DeprecationWarning,
362-
"Key '_is_trained' not found in state_dict. Setting to True.",
363-
):
364-
new_transform.load_state_dict(state_dict)
365358

366359
def test_log(self):
367360
ms = (1, 2)

0 commit comments

Comments
 (0)