Repository navigation
feat: shuffle a group's order in place with pipeline.shuffle - #143
Open
Hendrik-code wants to merge 1 commit into
Open
Hendrik-code wants to merge 1 commit into
Hendrik-code wants to merge 1 commit into
Conversation
`"pipeline": {"shuffle": ["TA"]}` redraws, once per batch, which transfer
augmentation occupies which of the positions the TA group already holds in
the sequential pipeline. `["GE"]` does the same for the general enhancements,
`["TA", "GE"]` both. Geometry and `force_sequential` transforms stay put, so
nothing that moves the mask is reordered.
The `random_order` modes cannot ask this question: they also regroup (every
TA ahead of every GE, LowRes hoisted) and dispatch through RandomChooseX
rather than kornia's forward. A shuffled sequential pipeline differs from the
unshuffled one in the order alone, and an absent or empty `shuffle` builds
exactly the pipeline it did before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
A new
pipelinekey,shuffle, that redraws the order of a transform group once per batch:The members of a group are permuted among the positions that group already holds in the sequential pipeline. Everything else stays where it is: geometry in front, the other group's transforms between them,
force_sequentialtransforms (LowRes), and each transform's ownpand batch semantics. The only transforms that move the mask (Flip, Affine, Crop, LowRes) are never reordered, so the image/mask pairing is untouched.Why not the existing
random_ordermodesThey also reorder, but they change more than order, so they can't answer "does the order matter":
RandomChooseXTransformsGPUbucket, which puts every TA ahead of every GE. On the paper config that moves the five elementwise functions and the bias field from after the GE block to before it, and hoists LowRes ahead of all TAs;apply_transformdirectly instead of going through kornia'sforward.A shuffled sequential pipeline differs from the unshuffled one in the order alone. Without
shuffle, or withshuffle: [], it builds exactly the pipeline it builds today (tested: byte-identical output under one seed).How
SmaugConfig.shuffle_groups()reads the key. Validation rejects unknown or duplicate groups,GEO, andshufflecombined with a bucket mode.build.shuffle_slots(pipeline, groups)reads each group's positions back from the registry.AugmentationSequentialCustom(shuffle_slots=...)overridesget_forward_sequence: when noparamsare given it permutes each slot group with onetorch.randperm. The drawn order goes into theParamItemlist, so the mask pass and any replay follow it.AugTransformsGPUpass it through. The trainer's config line now ends in, shuffle: TA(etc.) when it is set.One consequence to know about:
RandomSynthSegGPU,RandomPaletteGPUandRandomDomainTransferGPUare in the TA group. Undershuffle: ["TA"]they can land behind other TAs, and since they replace the image, whatever ran before them is overwritten (SynthSeg's EM clustering still sees it). None of the shipped configs combine these with the shuffle.Tests
unit_tests/test_pipeline_shuffle.py: config parsing and rejection, the slot set on the paper config, non-group positions fixed across draws, all 3! permutations reached, the applied order (viarecord_applications) matching the drawn order with the mask unchanged, and the empty-shuffle regression. The full CPU suite passes: 476 passed, 10 skipped (466 onmain+ 10 new). Ruff clean (local 0.17.1; CI pins 0.16.1). mypy was not run locally.🤖 Generated with Claude Code