Skip to content

test: jax_assertions/assertions_traced.py pins add_assertion on the JAX path (PyAutoFit#1581) - #100

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/traced-assertions-on-jax-path
Sep 8, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/traced-assertions-on-jax-path

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Witness script for PyAutoFit#1581, which makes model.add_assertion(...) enforceable on the JAX likelihood path. Before that change a violating sample let FitException escape from a non-vmapped JAX Fitness, and the vmapped Fitness Nautilus builds by default failed at trace time for every vector. The script pins the new contract on every Fitness surface and confirms the NumPy path is unchanged. Motivated by the Euclid two-basis MGE label degeneracy (euclid_strong_lens_modeling_pipeline#54).

Scripts Changed

  • scripts/jax_assertions/assertions_traced.py — new; top-level ordering assertion, compound-prior ordering between two components, jit and vmap surfaces, child-attached assertion gathered from the tree, NumPy path unchanged (ENV: jax)

Upstream PR

PyAutoLabs/PyAutoFit#1583

Test Plan

  • python scripts/jax_assertions/assertions_traced.py prints assertions_traced: all assertions passed against the branch PyAutoFit
  • python scripts/jax_assertions/fitness_dispatch.py still passes in the same environment
  • Merge only after the library PR (library-first gate); the script needs the released PyAutoFit that carries the change

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_015RALRY9yekWDTtbVfok64a

…AX path (PyAutoFit#1581)

Witness for the PyAutoFit change that evaluates model assertions as a traced
penalty: a top-level ordering assertion, a compound-prior ordering between two
components (the Euclid two-basis MGE shape), the jit and vmap Fitness
surfaces, a child-attached assertion gathered from the tree, and the
unchanged NumPy path. Violating vectors return the resample figure of merit
with no exception; satisfying vectors match the NumPy value.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015RALRY9yekWDTtbVfok64a
…ces, traced compound case

Review follow-up: enable x64 before importing jax (autonerves reads the env at
import; in a plain shell the -1e99 sentinel overflowed to -inf and the sentinel
check failed), compare against the sentinel as JAX represents it, use rtol=0,
and run the compound-prior ordering under jit and vmap as well as eagerly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015RALRY9yekWDTtbVfok64a
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Independent review: Codex CLI (gpt-6-astra, read-only sandbox). One defect, confirmed by running with env -u JAX_ENABLE_X64: the script imported jax before autofit, so in a plain shell JAX ran float32 and the -1e99 sentinel overflowed to -inf, failing the sentinel check (CI is unaffected because the harness exports JAX_ENABLE_X64=True). Fixed in 0339180: x64 enabled before import jax, the sentinel compared as JAX represents it, rtol=0, and the compound-prior ordering now also runs under jit and vmap. Passes with and without the env preset.

@Jammy2211
Jammy2211 merged commit 165a19e into main Sep 8, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/traced-assertions-on-jax-path branch September 8, 2026 17:55
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant