Repository navigation
Conversation
The per-model config classes were re-exported from both `sbi.neural_nets` and `sbi.neural_nets.net_builders`. The docs, the API reference and sbi itself only use `sbi.neural_nets`, and the second path was never released. `net_builders` now exports only the build functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CNF was dropped from the model registry when the Zuko flows were added in sbi-dev#1116, but its builder stayed. `posterior_nn("zuko_cnf")` raises `NotImplementedError` when it builds, and nothing in sbi calls the builder. `build_zuko_flow("CNF", ...)` builds the same network and stays tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ZScoreConfig`, `ZScoreStats`, `BuildContext` and `compute_z_score_stats` have no consumer yet. As decided in the NN builder design (Decision 10), they stay internal until the planned z-score pre-pass uses them. Rename the module to `sbi.neural_nets._build_context`, so 0.28 does not ship them as public API. The module was never released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seven places prepended a z-scoring layer to an embedding net with the same code: `build_z_scored_embedding_net` in the classifier builders, `_prepare_y_embedding` in the flow builders, `build_input_layer` in the restriction estimator, and inline copies in the MDN, categorical, mixed and vector-field builders. Move `build_z_scored_embedding_net` unchanged into `sbi.utils.sbiutils`, next to `standardizing_net`, and use it everywhere. It lives in `sbi.utils` because the restriction estimator cannot import from `sbi.neural_nets` without a circular import. The classifier module imports it back, and `build_input_layer` keeps its signature, so both released names keep working. Every call keeps its position, so the embedding net still runs at the same points of each build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2162 +/- ##
==========================================
+ Coverage 90.38% 90.59% +0.21%
==========================================
Files 142 143 +1
Lines 14884 14899 +15
==========================================
+ Hits 13453 13498 +45
+ Misses 1431 1401 -30
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What does this PR do?
Removes leftovers of the NN builder refactor before 0.28. The four commits are independent, so each can be dropped on its own.
sbi.neural_nets. The per-model configs were also re-exported fromsbi.neural_nets.net_builders. The docs, the API reference and sbi itself only usesbi.neural_nets, and the second path was never released.net_buildersnow exports only build functions.build_zuko_cnf. CNF left the registry during Zuko density estimators (#1088) #1116, but its builder stayed.posterior_nn("zuko_cnf")raisesNotImplementedErrorat build time, and nothing calls the builder.build_zuko_flow("CNF", ...)builds the same network (same weights and log-probs) and stays tested.build_contextinternal.ZScoreConfig,ZScoreStats,BuildContextandcompute_z_score_statshave no consumer yet. Following Decision 10 of the NN builder design, they stay private until the planned z-score pre-pass uses them: the module becomessbi.neural_nets._build_context. It was never released. @satwiksps, this settles the "unused seam" item of your post-GSoC plan. If you'd rather remove the module, that is one commit.build_z_scored_embedding_netmoves unchanged tosbi.utils.sbiutils, because the restriction estimator can't import fromsbi.neural_nets, and every builder now calls it. Each call stays where the old code was. The old classifier import path andbuild_input_layerkeep working.Release note:
build_zuko_cnf(shipped since v0.23) is removed; usesbi.neural_nets.net_builders.flow.build_zuko_flow("CNF", ...). No other behaviour changes.Does this close any issues?
No issue. It is cleanup from the NN builder refactor (#1872 to #1997).
Anything else we should know?
main. Three planted bugs were caught by this comparison: ignoringstructured, wrapping beforeget_numel, and copying the embedding net.main.z_score_ynow raises the sameValueErrorafterget_numelinstead of before it.build_zuko_cnf(keep the deletion). Simformer #1621 adds two names to an import block this PR deletes (re-add them as their own import). This PR merges cleanly with fix: embedding nets end in a linear layer, and two bugs in network building #2118, fix: potentials follow the caller's grad mode by default #2127, docs: fix stale method names, crashing examples and a default in docstrings #2145, fix: keep Standardize mean and std only as buffers, so .to() moves them #2155 and feat: parallel simulation with simulate_from_theta and parallelize_simulator #1738.Checklist
uv run pytest -n auto -m "not slow and not gpu"passes.uv run pre-commit run --all-filespasses (ruff and formatting).uv run pyright sbipasses.pytest.mark.slow. (Not applicable: the new tests take milliseconds.)🤖 Generated with Claude Code