Repository navigation
fix: Model pytree round-trip keeps fixed non-prior attributes - #1781
Merged
Merged
Conversation
Model.tree_flatten now carries the model's fixed direct attributes (not priors, TuplePriors or child models) in its aux data and tree_unflatten restores them, so an instance made from the rebuilt model no longer falls back to a prior-config lookup for a fixed value such as a sky level. Closes #1780 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Follow-up to #1777 / #1779.
Model.tree_flattennow carries the model's fixed direct attributes (not priors,TuplePriors or child models), such as a fixed sky level, in its aux data, andtree_unflattenrestores them. Before this, an instance made from the rebuilt model fell back to a prior-config lookup for the missing attribute and raisedConfigExceptionon a config-less class.Closes #1780
API Changes
None — internal changes only. The pytree aux data of
Modelgains a third element (the fixed attributes).Test Plan
ConfigExceptiononinstance_from_prior_medians()of the rebuilt model; (c) passed. After the fix all three return the same instance as the original model.test_model_round_trip_keeps_fixed_attributes_for_instances[a-c]intest_autofit/mapper/test_model_pytree_tuple_prior.py(fails 2/3 without the fix, passes with it); comparesinstance_from_prior_mediansandinstance_from_vectoragainst the original model.test_autofit(-n auto): 4273 passed; the 14 failed / 13 errors were xdist shared-output races (the set changed between runs); all 14 affected files rerun serially: 448 passed.pyauto-heart smoke autofit autogalaxy: pass.Full API Changes (for automation & release notes)
Changed Behaviour
autofit.Model.tree_flatten/tree_unflatten— fixed direct non-prior attributes now survive a JAX pytree round-trip.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code