google / jaxopt

Hardware accelerated, batchable and differentiable optimizers in JAX.
https://jaxopt.github.io
Apache License 2.0
922 stars 64 forks source link

Fix print for verbose=False #573

Closed vroulet closed 8 months ago

vroulet commented 8 months ago

Fix https://github.com/google/jaxopt/issues/571, added tests.

Joshuaalbert commented 8 months ago

I noticed a difference between linesearch verbosity setting for LBFGS and NonlinearCG.

In LBFGS

self.linesearch_solver = _setup_linesearch(
        linesearch=self.linesearch,
        fun=_fun_with_aux,
        value_and_grad=self._value_and_grad_with_aux,
        has_aux=True,
        maxlsiter=self.maxls,
        max_stepsize=self.max_stepsize,
        jit=self.jit,
        unroll=unroll,
        verbose=self.verbose,
    )

In NonlinearCG:

linesearch_solver = _setup_linesearch(
        linesearch=self.linesearch,
        fun=_fun_with_aux,
        value_and_grad=self._value_and_grad_with_aux,
        has_aux=True,
        maxlsiter=self.maxls,
        max_stepsize=self.max_stepsize,
        jit=self.jit,
        unroll=unroll,
        verbose=int(self.verbose)-1
    )

Maybe multi-level verbosity is actually not so useful?

vroulet commented 8 months ago

Yes, I had forgotten the multiple level verbosity for lbfgs. It's been corrected in this PR.

rupeshknn commented 4 months ago

I still face this issue, probably because there has been no release since Jan 10. when is the next release being planned?