BatchCentering and BatchLipNorm classes compatible with multi-GPU - #54
Merged
Conversation
franckma31
commented
Jan 28, 2026
Collaborator
- BatchCentering support for multi-GPU training, based on a running_mean accumulator and a running_num_batches (implemented as a special case of batchLipNorm class)
- BatchLipNorm compute the variance on batch and full set by using running means of square. This layer is not Lipschitz and can be used with a SharedLipFactory to maintain the global Lipschitz constant
- Vanilla export for BatchCentering and BatchLipNorm with the layer ScaleBiasLayer
- pytests on BatchCentering and BatchLipNorm
- LipschitzModule class inherits from ScaledLipschitzModule to be able to register the coefficient_lip to a SharedLipFactory
- multigpu tests are excluded from pytest : use torchrun on a multigpu config to run tests/multigpu scripts
…ng_mean accumulator and a running_num_batches
…seful only if we want to register scaling values), + modify scaling factor to get directly the multiplied value 1.0 / sqrt(max(var))
…ovide the get_scaling_factor and support factory also in LipschitzModule class
cofri
reviewed
Jan 29, 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.