facebook / Ax

Adaptive Experimentation Platform
https://ax.dev
MIT License
2.36k stars 307 forks source link

ValueError in Service API for pareto evaluation #1580

Closed yanniklockner closed 1 year ago

yanniklockner commented 1 year ago

Hey guys,

thank you guys a lot for the providing Ax. I am only getting started to work with the package, but already love the thought you put into it! Currently, I am targeting a multiobjective manufacturing problem, for which I'd like to use MOO_MODULAR from the modelregistry. I saw that in #1459 you removed it from the registry, arguing equal function with BOTORCH_MODULAR. Specifically, using the Service API, and calling ax_client.get_pareto_optimal_parameters(), the code crashes with the following traceback:

Traceback (most recent call last): File "foo.py", line 83, in initBayesOpt best_parameters, values = ax_client.get_pareto_optimal_parameters() File "someone\Python3.9.4\lib\site-packages\ax\service\ax_client.py", line 1498, in get_pareto_optimal_parameters return self._get_pareto_optimal_parameters( File "someone\Python3.9.4\lib\site-packages\ax\service\utils\best_point_mixin.py", line 311, in _get_pareto_optimal_parameters return best_point_utils.get_pareto_optimal_parameters( File "someone\Python3.9.4\lib\site-packages\ax\service\utils\best_point.py", line 568, in get_pareto_optimal_parameters objective_thresholds_override = modelbridge.infer_objective_thresholds( File "someone\Python3.9.4\lib\site-packages\ax\modelbridge\torch.py", line 185, in infer_objective_thresholds model = checked_cast(MultiObjectiveBotorchModel, self.model) File "someone\Python3.9.4\lib\site-packages\ax\utils\common\typeutils.py", line 58, in checked_cast raise exception if exception is not None else ValueError( ValueError: Value was not of type <class 'ax.models.torch.botorch_moo.MultiObjectiveBotorchModel'>: <ax.models.torch.botorch_modular.model.BoTorchModel object at 0x000002C0DDECE310>

So I understood that we are supposed to use BOTORCH_MODULAR for moo as well, but how can I avoid this error, as the modelregistry specifies the model_class to be a ModularBoTorchModel? Thank you very much for your help! Y.

Balandat commented 1 year ago

@mpolson64 could you please take a look at this? Seems like there are some fixes on our end needed here.

mpolson64 commented 1 year ago

Sorry this has taken me some time to get back to. This is indeed a bug on our end -- thank you for finding it! I've put up a fix in the attached PR and it should be available in the next maintenance release which I'm hoping to get out this week. I will update you in this Issue when the fix is live.

https://github.com/facebook/Ax/pull/1590

mpolson64 commented 1 year ago

This is fixed as of https://github.com/facebook/Ax/releases/tag/0.3.2 -- closing the task.