fix: register_model in visualization_jax.py to actually exercise JIT path#37
Merged
fix: register_model in visualization_jax.py to actually exercise JIT path#37
Conversation
Adds enable_pytrees() + register_model(model) so jax.jit(fit_from) can trace the ModelInstance argument across the JIT boundary. Without these the script silently failed with TypeError — the try/except wrapper printed "PILOT FAILED" and exited 0, so test runners never noticed. Drops the swallowed-exception pattern so future regressions fail loud. Splits env_vars.yaml's imaging/visualization override into a NumPy-only entry (visualization.py) and a JAX-only entry (visualization_jax) that unsets PYAUTO_DISABLE_JAX, mirroring the existing imaging/modeling_visualization_jit override. Lead PR (closes #84): autolens_workspace_test sibling. Verified: PILOT SUCCEEDED with JAX enabled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/imaging/visualization_jax.pywas silently broken under JAX since PyAutoGalaxy #390 (2026-05-08) madeVisualizerImaging.visualizedispatch throughanalysis.fit_for_visualization(which JITsfit_from). Withoutenable_pytrees()+register_model(model),jax.jit(fit_from)cannot trace theModelInstanceargument and raisesTypeError. The script'stry/exceptwrapper caught the failure, printed "PILOT FAILED", and exited 0 — so test runners never noticed.This PR adds the two missing calls, drops the swallowed-exception pattern so future regressions fail loud, and splits the
imaging/visualizationenv_vars override into a NumPy-only entry and a JAX-only entry that unsetsPYAUTO_DISABLE_JAX, mirroring the existingimaging/modeling_visualization_jitoverride.Lead PR (closes the tracking issue): PyAutoLabs/autolens_workspace_test#85
Scripts Changed
scripts/imaging/visualization_jax.py— addenable_pytrees()+register_model(model); droptry/exceptwrapper; update docstring to reflect the Path-A (jit-traced) intentconfig/build/env_vars.yaml— splitimaging/visualizationoverride; addimaging/visualization_jaxentry that unsetsPYAUTO_DISABLE_JAXTest Plan
python scripts/imaging/visualization_jax.py(with JAX enabled) —PILOT SUCCEEDED — JAX-backed visualization produced fit.png/galaxies.png.🤖 Generated with Claude Code