feat: register every augmentation - #68
Open
Hendrik-code wants to merge 1 commit into
Open
Conversation
Each of the 51 augmentation classes now carries an @register(...) decorator naming its backend, its GEO/GE/TA group and the backend-neutral concept it implements. smauglab/transforms/__init__.py imports them all, so importing that package is what populates the registry -- that is what registry.load_all() does. The batchgeneratorsv2 transforms the CPU pipeline composes are third-party and cannot be decorated, so smauglab/transforms/cpu/external.py builds their entries by hand. Two things there are declared per entry rather than assumed: wrap_random=False for transforms appended directly rather than inside a RandomTransform (they own no probability, so a config setting `p` is an error), and context_params for values nnU-Net supplies at runtime. The registered set and registry.PIPELINE_ORDER now agree exactly, 29 GPU and 22 CPU, and that is checked in both directions: registration rejects a class missing from the table, and a test rejects a table entry nothing registers. The `if` ladders still run and still decide what a config builds. Nothing reads the registry yet except the tests, which is deliberate -- this commit is only about the metadata being present and correct. Two things had to come with it: * RandomDomainTransferGPU still took **kwargs, so registering it failed the no-**kwargs-without-forwards_to rule. Removed. The previous commit's message claimed **kwargs was gone from every transform constructor; that was true of every file it touched, but it did not touch this one. * Its bank path was a hardcoded absolute path into one machine's NAS home directory, which is what external_asset exists to describe. It becomes the SMAUGLAB_DOMAIN_BANK environment variable, with no baked-in default and an error message that names the fix. Tests consult the registry entry rather than hardcoding the class, so a second such transform is covered automatically. Verified: with SMAUGLAB_DOMAIN_BANK pointing at the bank, all 24 seeded config digests are unchanged, including the domain-transfer config. Without it that one config skips rather than running, which is the only behaviour difference and the point of the change -- it was previously found by accident on exactly one machine. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 21, 2026
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.
Stacked on #67.
Each of the 51 augmentation classes now carries an
@register(...)decorator naming its backend, its GEO/GE/TA group, and the backend-neutral concept it implements.smauglab/transforms/__init__.pyimports them all, so importing that package is what populates the registry — that's whatregistry.load_all()does.The batchgeneratorsv2 transforms the CPU pipeline composes are third-party and can't be decorated, so
smauglab/transforms/cpu/external.pybuilds their entries by hand. Two things are declared per entry rather than assumed:wrap_random=Falsefor transforms appended directly rather than inside aRandomTransform— they own no application probability, so a config settingpon them is an error.context_paramsfor values nnU-Net supplies at runtime (patch size, rotation range) — a config must not set those.The registered set and
PIPELINE_ORDERnow agree exactly: 29 GPU, 22 CPU — checked in both directions. Registration rejects a class missing from the table; a test rejects a table entry that nothing registers.The
ifladders still run and still decide what a config builds. Nothing reads the registry yet except the tests. That's deliberate: this PR is only about the metadata being present and correct.Two things that had to come along
RandomDomainTransferGPUstill took**kwargs, so registering it failed the no-**kwargs-without-forwards_torule. Removed.**kwargsis gone from every transform constructor". That was true of every file it touched, but it did not touchdomain_transfer.py— I'd reverted that file there to keep the PR focused. I've corrected #66's description.Its bank path was a hardcoded absolute path into one machine's NAS home directory:
That is exactly what the registry's
external_assetfield exists to describe, so it becomes theSMAUGLAB_DOMAIN_BANKenvironment variable — no baked-in default, and an error message that names the fix. Tests consult the registry entry rather than hardcoding the class name, so a second such transform is covered automatically.Verification
With
SMAUGLAB_DOMAIN_BANKpointing at the bank, all 24 seeded config digests are unchanged, including the domain-transfer one. Without it, that single config skips instead of running — the only behaviour difference, and the point of the change: it previously resolved by accident on exactly one machine and was silently broken for everyone else.Full suite: 141 passed, 5 skipped, 478 subtests (up from 237 — every registered augmentation now gets a construct-and-run smoke test).
ruffandmypyclean.