Skip to content

Support loading legacy-serialized probabilistic layer configs - #71

Merged
dnerini merged 5 commits into
mainfrom
fix/legacy-distribution-layer-config-compat
Sep 28, 2026
Merged

dnerini merged 5 commits into
mainfrom
fix/legacy-distribution-layer-config-compat

Conversation

@dnerini

@dnerini dnerini commented Sep 10, 2026

Copy link
Copy Markdown
Member

Distribution layers saved before @register_keras_serializable() was introduced serialized their Lambda/DistributionLambda function as Python bytecode (function, arguments, make_distribution_fn, etc.), which isn't portable across Python versions and causes old saved models to fail loading on newer Python/TF. This adds a from_config classmethod to each probabilistic layer that strips these legacy, no-longer-accepted keys before reconstructing the layer, restoring backward compatibility without changing serialization for newly saved models.

@dnerini
dnerini merged commit fb95d77 into main Sep 28, 2026
4 checks passed
@dnerini
dnerini deleted the fix/legacy-distribution-layer-config-compat branch September 28, 2026 08:20
dnerini added a commit that referenced this pull request Sep 28, 2026
Resolve conflicts in favour of the torch line: #71's TFP from_config
shims are obsolete here (they remain on the v0.x line). Keep main's
py3.12 support and dev security pins, bump version to 1.0.0, install
CPU-only torch in CI and relock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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