You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from torchquad import set_up_backend, MonteCarlo
set_up_backend("jax", data_type="float32")
The code above throws the exception below on latest jax version. The reason is that the jax.config submodule has been removed (previously it was also deprecated)
File <project>\env\Lib\site-packages\torchquad\utils\set_precision.py:58, in set_precision(data_type, backend)
[56](file://<project>/env/Lib/site-packages/torchquad/utils/set_precision.py:56) torch.set_default_tensor_type(tensor_dtype)
[57](file://<project>/env/Lib/site-packages/torchquad/utils/set_precision.py:57) elif backend == "jax":
---> [58](file://<project>/env/Lib/site-packages/torchquad/utils/set_precision.py:58) from jax.config import config
[60](file://<project>/env/Lib/site-packages/torchquad/utils/set_precision.py:60) config.update("jax_enable_x64", data_type == "float64")
[61](file://<project>/env/Lib/site-packages/torchquad/utils/set_precision.py:61) logger.info(f"JAX data type set to {data_type}")
ModuleNotFoundError: No module named 'jax.config'
Expected Behavior
It should not throw an exception
What Needs to be Done
Replacing from jax.config import config with from jax import config
How Can It Be Tested or Reproduced
Install latest jax and torchquad and run example above. In my case I used jax-0.4.35 and torchquad 0.4.0.
The text was updated successfully, but these errors were encountered:
javier-garcia-tilburg
changed the title
[Jax] set_precision throws exception on latest jax version
[jax] set_precision throws exception on latest jax version
Nov 25, 2024
Workaround is to use set_up_backend("jax") and avoid set_precision. Numerical precision can still be configured manually within jax, e.g. jax.config.update("jax_enable_x64", True).
Thanks for pointing it out. I have merged the related PR changes and created a new minor release with this and additional smaller changes. It can already be tested via pip install torchquad==0.4.1 and should fix this hopefully. conda version should follow in a couple of days. Feel free to re-open in case of issues.
Issue
Problem Description
The code above throws the exception below on latest jax version. The reason is that the jax.config submodule has been removed (previously it was also deprecated)
Expected Behavior
It should not throw an exception
What Needs to be Done
Replacing
from jax.config import config
withfrom jax import config
How Can It Be Tested or Reproduced
Install latest
jax
andtorchquad
and run example above. In my case I usedjax-0.4.35
andtorchquad 0.4.0
.The text was updated successfully, but these errors were encountered: