Skip to content

Commit

Permalink
Add fixed noise models to reverse registry (#1938)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1938

The changes in D50431137 removed these models from the values of `MODEL_REGISTRY`, which lead to them getting removed from the reverse registry as well. Since these models appear in the DB for the past experiments, we need to manually add them to the reverse registry.

Reviewed By: sdaulton

Differential Revision: D50742593

fbshipit-source-id: 67cb966ae2d78c9234dbdc9f8caa62cf26335a7f
  • Loading branch information
saitcakmak authored and facebook-github-bot committed Oct 27, 2023
1 parent 756142d commit 94c1cbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ax/storage/botorch_modular_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@


REVERSE_MODEL_REGISTRY: Dict[str, Type[Model]] = {
v: k for k, v in MODEL_REGISTRY.items()
"FixedNoiseGP": SingleTaskGP,
"FixedNoiseMultiFidelityGP": SingleTaskMultiFidelityGP,
"FixedNoiseMultiTaskGP": MultiTaskGP,
**{v: k for k, v in MODEL_REGISTRY.items()},
}


Expand Down
6 changes: 4 additions & 2 deletions ax/utils/testing/modeling_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,18 @@ def get_surrogate_as_dict() -> Dict[str, Any]:
}


def get_surrogate_spec_as_dict() -> Dict[str, Any]:
def get_surrogate_spec_as_dict(model_class: Optional[str] = None) -> Dict[str, Any]:
"""
For use ensuring backwards compatibility when loading SurrogateSpec
with input_transform and outcome_transform kwargs.
"""
if model_class is None:
model_class = "SingleTaskGP"
return {
"__type": "SurrogateSpec",
"botorch_model_class": {
"__type": "Type[Model]",
"index": "SingleTaskGP",
"index": model_class,
"class": "<class 'botorch.models.model.Model'>",
},
"botorch_model_kwargs": {},
Expand Down

0 comments on commit 94c1cbd

Please sign in to comment.