Repository navigation
feat: factors left on the default setup adopt one shared backend in a FactorGraphModel - #1801
Merged
Jammy2211 merged 1 commit intoNov 26, 2026
Merged
Conversation
… FactorGraphModel Part of PyAutoLabs/PyAutoLens#895. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jammy2211
deleted the
feature/likelihood-lifecycle-r6d-prerelease-fixes
branch
November 26, 2026 12:39
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
Part of PyAutoLabs/PyAutoLens#895 (likelihood-lifecycle R6 pre-release fixes; must merge before the release carrying R6 phase A). Same branch
feature/likelihood-lifecycle-r6d-prerelease-fixesin PyAutoFit, PyAutoGalaxy and PyAutoLens. Merge order: Fit → Galaxy → Lens.Under the R6 default
setup="auto", aFactorGraphModelmixing dataset types (imaging + interferometer, imaging + point) failedcheck_setup_agreement: each default-constructed factor resolved its own setup. Human ruling: factors left on the default setup adopt one shared backend.af.Analysis:setup_is_default(property,False) andadopt_backend(use_jax)(no-op), forwarded byAnalysisFactorandModelAnalysis(which also refreshes_use_jax).FactorGraphModel.adopt_shared_backend(), called inmodify_before_fitbetween forwarding andcheck_setup_agreement. Factors the user configured (setup=oruse_jax=) are never changed; if they disagree it still raises. Otherwise the backend is the graph'suse_jax, else the configured factors' common backend, else JAX when available. Defaulted factors adopt it when setups disagree or when they differ from a set backend. Nested graphs implement the hooks too; expectation propagation never calls this path.check_setup_agreement's message explains the default vs explicit distinction.API Changes
Added
af.Analysis.setup_is_default,af.Analysis.adopt_backend(use_jax),FactorGraphModel.adopt_shared_backend().See full details below.
Test Plan
[optional]extras, jax family uninstalled): PyAutoFit 4072, PyAutoGalaxy 1601, PyAutoLens 1114 passed, 0 failedweak/modeling.pyon the default (JAX) setup, andmulti_dataset/features/imaging_and_interferometer/modeling.py+imaging_and_point_source/modeling.pywith everyuse_jax=Trueremoved — all exit 0pyauto-heart smoke --affected-by PyAutoFitagainst the task worktree: 8/8 workspaces passedtest_factor_graph_setup.py(+8, mock analyses; 7 failed on control)Full API Changes (for automation & release notes)
Added
af.Analysis.setup_is_default→bool(defaultFalse);af.Analysis.adopt_backend(use_jax: bool)(no-op default); both forwarded byAnalysisFactor,ModelAnalysis, nestedFactorGraphModel.af.FactorGraphModel.adopt_shared_backend().Changed
FactorGraphModel.modify_before_fitaligns factors left on the default setup beforecheck_setup_agreement.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code