botorch icon indicating copy to clipboard operation
botorch copied to clipboard

add model to __all__

Open jduerholt opened this issue 6 months ago • 6 comments

Motivation

RobustRelevancePursuitSingleTaskGP is not listed in __all__ in bofire/models/__init__.py. This PR adds it.

Have you read the Contributing Guidelines on pull requests?

Yes.

Test Plan

Not needed.

jduerholt avatar May 21 '25 06:05 jduerholt

Hmm, one gets circular imports when one adds it, I assume this was the reason for not adding it in the first place ..., so I think, I should close this PR again, or what do you think?

jduerholt avatar May 21 '25 06:05 jduerholt

Hmm, interesting. I though this would be fixable by changing the from botorch.models import SingleTaskGP in https://github.com/pytorch/botorch/blob/main/botorch/models/robust_relevance_pursuit_model.py#L40 to from botorch.models.gp_regression import SingleTaskGP but that in itself will cause a circular import.

@SebastianAment since you wrote this code, do you have a better sense of what the issue here is?

Balandat avatar May 21 '25 13:05 Balandat

It is also not important at all. We just encountered that the RobustRelevancePursuitSingleTaskGP has to be imported in a different way than the other models and I thought it should be easily fixable so I fired up this PR without even running the tests locally ..., but this has no priority for us at all, we import now directly from the source file ...

jduerholt avatar May 21 '25 13:05 jduerholt

Yeah - though the fact that things break even if you don't do this but instead adjust the import as in https://github.com/pytorch/botorch/pull/2854#issuecomment-2897994321 is disconcerting - we should understand what causes this and fix it.

Balandat avatar May 21 '25 13:05 Balandat

It is also not important at all. We just encountered that the RobustRelevancePursuitSingleTaskGP has to be imported in a different way than the other models and I thought it should be easily fixable so I fired up this PR without even running the tests locally ..., but this has no priority for us at all, we import now directly from the source file ...

I suspect this is because I added the relevance pursuit model to the multiple dispatch of fit_gpytorch_mll. That file likely introduces the import issue, but haven't checked, currently on vacation.

SebastianAment avatar May 21 '25 13:05 SebastianAment

Hmm yeah that would make sense. Let's take a look and see if that's the case when you're back; we may want to think about separating out the registries in a way that would avoid these circular import issues.

Balandat avatar May 21 '25 14:05 Balandat