From 07eb6719db68fb3bd5b9775417de3e21d82aef66 Mon Sep 17 00:00:00 2001 From: Elizabeth Santorella Date: Thu, 17 Aug 2023 00:14:22 -0700 Subject: [PATCH] More thorough PTS testing (#1784) Summary: Pull Request resolved: https://github.com/facebook/Ax/pull/1784 Background: Jelena somehow noticed that D46519588 could break PTS because an unused argument was being passed and ignored, which D46519588 would disallow. See https://fburl.com/diff/ttaw0v83 It turns out that there are _two or three_ reasons that unit tests would not have caught this issue: * There was no sufficiently end-to-end test for usage of FBModels.BOPE and FBModels.BOPE_MTGP; we never "gen" based on them * "gen" is mocked out in the analyzer tests, so we wouldn't have caught those errors anyway * Exceptions are logged rather than raised, so without careful testing, the exception raised wouldn't have triggered a test breakage. Changes: So we need 1) a test that combines FBModels.BOPE and FBModels.BOPE with actually generating candidates (perhaps with fast_botorch_optimize), and 2) better testing in PTSAnalyzer and perhaps other parts of PTS in general. I attempted to add (1) and remove the mock of "gen", but I'm haaving a hard time due to my lack of familiarity with PTS. Help writing these tests would be very appreciated! Reviewed By: lena-kashtelyan Differential Revision: D48288094 fbshipit-source-id: a0cb5009657eff70f5e9dcac9cf4d636e4c5eaf9 --- ax/models/torch/alebo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ax/models/torch/alebo.py b/ax/models/torch/alebo.py index 113007c8d73..c620c305927 100644 --- a/ax/models/torch/alebo.py +++ b/ax/models/torch/alebo.py @@ -73,7 +73,8 @@ def __init__(self, B: Tensor, batch_shape: torch.Size) -> None: ) # pyre-fixme[4]: Attribute must be annotated. self.d, D = B.shape - assert self.d < D + if not self.d < D: + raise ValueError(f"Expected B.shape[0] < B.shape[1], but got {B.shape=}.") self.B = B # Initialize U Arnd = torch.randn(D, D, dtype=B.dtype, device=B.device)