optax icon indicating copy to clipboard operation
optax copied to clipboard

fix: default hyperparams to float32 unless specified

Open akramcodez opened this issue 2 months ago • 2 comments

Respect hyperparam_dtype in inject_hyperparams.

If hyperparam_dtype is not provided, injected hyperparameters now default to jnp.float32 rather than inheriting dtypes from parameters/updates. Explicit hyperparam_dtype values continue to be honored. This avoids accidental low-precision hyperparameters (e.g., bfloat16) while preserving explicit control.

  • Files: _inject.py
  • Tests: Local suite passed + targeted schedule tests passed. Also verified via small reproducer: default → float32; explicit hyperparam_dtype=jnp.bfloat16 → bfloat16.
  • Note: A unit test for default dtype is prepared but omitted per instruction; can include if requested.

Fixes: #1414

akramcodez avatar Oct 25 '25 09:10 akramcodez

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Oct 25 '25 09:10 google-cla[bot]

PTAL @sizhit2

akramcodez avatar Oct 25 '25 15:10 akramcodez