Skip to content

Commit 59a7802

Browse files
Jammy2211Jammy2211claude
authored
fix: pin tfp-nightly for the JAX Matern-kernel path (tfp 0.25.0 × jax 0.10.2 crash) (#386)
The last stable tensorflow-probability (0.25.0) references jax.interpreters.xla.pytype_aval_mappings, removed from modern JAX, so it crashes at import under the resolved jax>=0.7 stack — breaking every Matern-kernel pixelization on the JAX backend (release-validation run 29266305445). Swap the pin to tfp-nightly==0.26.0.dev20260713 (verified to compute bessel_kve on jax 0.10.2) and correct the kv_xp docstring/ImportError. Fixes #385 Claude-Session: https://claude.ai/code/session_01TDCsgNCXacXqiWAPTswWCt Co-authored-by: Jammy2211 <JNightingale2211@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7ff0b1e commit 59a7802

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

autoarray/inversion/regularization/matern_kernel.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ def kv_xp(v, z, xp=np):
1717
-> scipy.special.kv
1818
1919
JAX backend:
20-
-> jax.scipy.special.kv if available
21-
-> else tfp.substrates.jax.math.bessel_kve * exp(-|z|)
20+
-> tensorflow_probability.substrates.jax.math.bessel_kve * exp(-|z|)
21+
22+
`jax.scipy.special` has no modified-Bessel-K (`kv`/`kve`) of arbitrary real
23+
order, so the JAX path relies on tfp's `bessel_kve`. Note the tfp dependency
24+
is the *nightly* build (`tfp-nightly`): the last stable release
25+
(`tensorflow-probability==0.25.0`) crashes at import under the resolved
26+
`jax>=0.7` stack (it references `jax.interpreters.xla.pytype_aval_mappings`,
27+
removed from modern JAX).
2228
"""
2329

2430
# -------------------------
@@ -39,8 +45,10 @@ def kv_xp(v, z, xp=np):
3945
return tfp.math.bessel_kve(v, z) * xp.exp(-xp.abs(z))
4046
except ImportError:
4147
raise ImportError(
42-
"To use the JAX backend with the Matérn kernel, "
43-
"please install tensorflow-probability via `pip install tensorflow-probability==0.25.0`."
48+
"To use the JAX backend with the Matérn kernel, install the "
49+
"tensorflow-probability nightly via "
50+
"`pip install tfp-nightly==0.26.0.dev20260713` "
51+
"(the last stable release, 0.25.0, is incompatible with modern JAX)."
4452
)
4553

4654

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ optional = [
5858
"numba",
5959
"nufftax>=0.4.0,<0.5.0; python_version >= '3.12'",
6060
"pynufft",
61-
"tensorflow-probability==0.25.0"
61+
# tfp provides the modified-Bessel `bessel_kve` used by the JAX Matern-kernel
62+
# regularization path (autoarray/inversion/regularization/matern_kernel.py).
63+
# The last *stable* release (tensorflow-probability==0.25.0) targets a JAX where
64+
# `jax.interpreters.xla.pytype_aval_mappings` still existed; it crashes at import
65+
# under the resolved `jax>=0.7` stack (autoconf[jax]). The nightly restores
66+
# compatibility. Durable fix (vendor bessel_kve, drop tfp) tracked separately.
67+
"tfp-nightly==0.26.0.dev20260713"
6268
]
6369
test = ["pytest"]
6470
dev = ["pytest", "black", "numba", "nufftax>=0.4.0,<0.5.0; python_version >= '3.12'", "pynufft==2022.2.2"]

0 commit comments

Comments
 (0)