Skip to content

fix: Model pytree round-trip keeps fixed non-prior attributes - #1781

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/model-pytree-fixed-attributes
Nov 18, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/model-pytree-fixed-attributes

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1777 / #1779. Model.tree_flatten now carries the model's fixed direct attributes (not priors, TuplePriors or child models), such as a fixed sky level, in its aux data, and tree_unflatten restores them. Before this, an instance made from the rebuilt model fell back to a prior-config lookup for the missing attribute and raised ConfigException on a config-less class.

Closes #1780

API Changes

None — internal changes only. The pytree aux data of Model gains a third element (the fixed attributes).

Test Plan

  • Repro on the branch before the fix: cases (a) all fixed and (b) grid_offset free / sky fixed raised ConfigException on instance_from_prior_medians() of the rebuilt model; (c) passed. After the fix all three return the same instance as the original model.
  • New test_model_round_trip_keeps_fixed_attributes_for_instances[a-c] in test_autofit/mapper/test_model_pytree_tuple_prior.py (fails 2/3 without the fix, passes with it); compares instance_from_prior_medians and instance_from_vector against the original model.
  • All pytree-related tests: 190 passed.
  • Full 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

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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 18, 2026
@Jammy2211
Jammy2211 merged commit 3ba1e6c into main Nov 18, 2026
6 checks passed
@Jammy2211
Jammy2211 deleted the feature/model-pytree-fixed-attributes branch November 18, 2026 14:00
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 19, 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.

fix: Model pytree round-trip drops fixed non-prior attributes

1 participant