Repository navigation
Description
Overview
scripts/searches/mcmc.py (and its generated notebook) still tells users to call enable_pytrees() / register_model(model) before running BlackJAXNUTS. Neither is exposed on af, Fitness.__init__ already calls both internally, and scripts/searches/mle.py in the same workspace says the opposite ("No JAX pytree registration of the model is needed"). The PyAutoFit half of this bug (stale advice in the NUTS/SMC error strings) is already fixed on main; this issue covers the workspace half only.
Plan
- Remove requirement 2 (pytree registration) from the
BlackJAXNUTSprose inscripts/searches/mcmc.py, leavinguse_jax=Trueas the one requirement and noting that registration happens internally. - Delete the
from autofit.jax.pytrees import enable_pytrees, register_modelimport and the two calls. - Regenerate the matching cells of
notebooks/searches/mcmc.ipynbthe same way. - Run the NUTS section of the script to confirm the fit still runs without the explicit calls.
Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary
Detailed implementation plan
Affected repositories
- autofit_workspace (primary, only)
Work classification
Workspace (bug). Library half verified done on PyAutoFit@362ee746: git grep enable_pytrees autofit/ hits only autofit/jax/ and autofit/non_linear/fitness.py:330-333 (the internal call); BlackJAXNUTS with use_jax=False raises SearchException naming use_jax=True only.
Branch survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| autofit_workspace | main | clean |
Suggested branch: feature/stale-enable-pytrees-advice
Worktree root: ~/Code/PyAutoLabs-wt/stale-enable-pytrees-advice/
Implementation steps
scripts/searches/mcmc.py~L238-247: collapse "Two requirements" to the singleuse_jax=Truerequirement; say the model is registered as a JAX pytree automatically when the fit starts, so no extra call is needed.scripts/searches/mcmc.pyL283-286: delete the import and both calls.notebooks/searches/mcmc.ipynb: same edits to the matching markdown and code cells.
Key files
scripts/searches/mcmc.pynotebooks/searches/mcmc.ipynb
Witness
grep -rn enable_pytrees autofit/ autofit_workspace/scripts/searches/ returns no user-facing advice; BlackJAXNUTS with use_jax=False raises an error naming use_jax=True only.
Original Prompt
Click to expand starting prompt
Stale enable_pytrees register_model advice in NUTS and SMC errors and searches docs
Type: bug
Target: PyAutoFit
Repos:
- PyAutoFit
- autofit_workspace
Difficulty: small
Autonomy: safe
Priority: normal
Status: formalised
Consequence: glance
Witness: grep -rn enable_pytrees autofit/ autofit_workspace/scripts/searches/ returns no user-facing advice; BlackJAXNUTS with use_jax=False raises an error that names use_jax=True only.
Review-minutes: 3
Unattended: ready
Lane: any
autofit/non_linear/search/mcmc/blackjax/nuts/search.py:270 and autofit/non_linear/search/mcmc/blackjax/smc/search.py:328 tell users to call enable_pytrees() / register_model(model), and the workspace script scripts/searches/mcmc.py lines 244-247 and 283-286 do the same in prose and code. Neither function is exposed on the af namespace and Fitness.init (autofit/non_linear/fitness.py:261-265) already calls them internally; scripts/searches/mle.py:232-235 in the same workspace says the opposite. NUTS was verified to run without them on 2026-09-10. Fix the two error strings and the mcmc.py prose (the workspace half lands in autofit_workspace).
Re-scoped 2026-11-05 — what is left (draft-queue sweep)
- Done: Library advice removed: PyAutoFit now has
enable_pytreesonly in jax/pytrees.py, jax/init.py and fitness.py, not in the blackjax nuts/smc searches (commit not pinned). - Remaining: autofit_workspace
scripts/searches/mcmc.py(and its notebook) still teachesenable_pytrees()/register_model— fix the workspace leg.
Evidence from the 2026-11-05 read-only sweep (Mind ledger + GitHub search); remaining items are the live scope of this prompt.
Activity
Jammy2211 commentedon Nov 14, 2026
Shipped: merged in #185 (5267644).
scripts/searches/mcmc.pyand its notebook no longer tell users to callenable_pytrees()/register_model(model);Fitness.__init__registers the model automatically for any JAX analysis. The PyAutoFit half (NUTS/SMC error strings) was already fixed on main.Independent close-out witness: no
enable_pytrees/register_modelhits inscripts/searches/ornotebooks/searches/at the PR head;BlackJAXNUTSwithuse_jax=Falseraises aSearchExceptionthat namesuse_jax=Trueonly. CI 7/7 green, Heart dev-ship green.