Discover and explore top open-source AI tools and projects—updated daily.
PyTorch module for sublinear memory optimization
Top 54.3% on SourcePulse
This repository provides a sublinear memory optimization for PyTorch deep learning models, targeting researchers and practitioners who need to train larger models or use larger batch sizes within limited GPU memory. It achieves this by reducing the memory footprint required for backpropagation from linear to square-root complexity.
How It Works
The core idea is to trade computation for memory by re-computing intermediate activations during the backward pass, rather than storing them all from the forward pass. This is implemented by replacing PyTorch's nn.Sequential
with memonger.SublinearSequential
. For models with non-deterministic layers like BatchNorm and Dropout, specific handling is included to maintain correctness, such as re-scaling BatchNorm momentum and memorizing RNG states for Dropout.
Quick Start & Requirements
pip install pytorch-memonger
nn.Sequential
models.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
nn.Sequential
models due to PyTorch's define-by-run nature.5 years ago
Inactive