Skip to content

Commit

Permalink
maint: disable new jax jit implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gattocrucco committed Mar 27, 2023
1 parent 6fe47c4 commit 2b1934f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lsqfitgp/_patch_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
import pathlib
import traceback

# disable this jax 0.4.4 feature because it makes empbayes_fit fail under jit
# due to leaked tracers
import os
os.environ['JAX_JIT_PJIT_API_MERGE'] = '0'

from jax.config import config
config.update("jax_enable_x64", True)

Expand Down Expand Up @@ -120,9 +125,12 @@ def __exit__(self, exc_type, exc_value, tb):
if exit or exc_type in (jax.errors.ConcretizationTypeError, jax.errors.TracerArrayConversionError):
return True

if exc_type is IndexError and traceback.extract_tb(tb)[-1].name == 'arg_info_pytree': # pragma: no cover
weird_cond = exc_type is IndexError and (
traceback.extract_tb(tb)[-1].name in ('arg_info_pytree', '_origin_msg'),
)
if weird_cond: # pragma: no cover
# TODO this ignores a jax internal bug I don't understand, appears
# in examples/pdf4.py, and not on CI
# in examples/pdf4.py
return True

# TODO make stop_hessian work in reverse mode
Expand Down

0 comments on commit 2b1934f

Please sign in to comment.