-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to prevent jitting in jaxopt solver? #444
Comments
Update: I noticed that my implementation of the backward derivative
However, now I got a different error, which might be related to this particular example:
I also tried two different solvers - GradientDescent worked as expected while BFGS recreated the |
Hi! Thanks for the bug report. There were two problems here. One on your side: the VJP should return an array of size 1, not a scalar (the output of the VJP should always have the same shape as the input of the function) return (np.array([grad_x * g]),) One on our side: zoom line search and Hager-Zhang line search don't work with non-jittable functions for the moment (we'll fix this). As a temporary workaround, you can use the backtracking linesearch solver = jaxopt.LBFGS(fun=f, jit=False, maxiter=10, linesearch="backtracking") |
Hi @mblondel. Thank you so much for your response! I really appreciate the fact that the team is already working on addressing this! |
Dear jaxopt team,
I am writing to inquire about an issue I encountered when using jaxopt's
LBFGS
solver with a custom objective function that is not jittable but has defined custom VJPs. Despite specifyingjit=False
to disable JIT compilation, the solver still throws aTracerArrayConversionError
as if it was attempting to JIT-compile the objective function. I have prepared a minimal example to reproduce the issue:If my understanding is correct, setting
jit=False
should prevent JIT compilation of the objective function. However, this does not seem to be the case. Could you please let me know if I am missing something here or is this perhaps a bug?The text was updated successfully, but these errors were encountered: