-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Bug] filter_kwargs warning leads to unintended thrown exception, when using partial
#1667
Comments
Thanks for the report. This is interesting, I've never seen To support this specific use case we could just check whether this is a An alternative would be to just subclass the model and write an cc @esantorella as this seems to be a consequence of your recent changes. |
Good point, will make a new issue for tracking this. |
This is a great point, thanks for the bug report! This would also fail if from scipy.optimize import minimize
from functools import partial
# raises AttributeError
partial(minimize, method="L-BFGS-B").__name__ I'll put in a fix! |
…ut a `__name__` attribute Summary: See pytorch#1667 Differential Revision: D43286116 fbshipit-source-id: 2cd830e8206774998f57302c69fb7078d33b4033
🐛 Bug
Currently if I run
batch_cross_validation
usingpartial(MyModel, ...)
as mymodel_cls
, botorch accidentally throws an exception. The exception happens during param checking, when it tries to print the__name__
of thepartial
. This code worked without throwing an exception until the recent changes to_filter_kwargs
.This
warn
happens by default withbatch_cross_validation
because this function passes intrain_Yvar=None
into the class, which many classes don't use (e.g.SingleTaskGP
). You might consider this a second bug;batch_cross_validation
should only pass intrain_Yvar
if it is not None.To reproduce
Here's an isolated repro that doesn't require calling
batch_cross_validation
.** Stack trace/error message **
Expected Behavior
It should just print a warning, as the code intended. Instead, the printing code itself is hitting an error.
System information
botorch: 0.7.3.dev22+g208470e7.d20221102
gpytorch: 1.9.1.dev32+g23b068b5
torch: 1.13.1
MacOS M1
The text was updated successfully, but these errors were encountered: