Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/2.5] ModuleTracker: Add explicit garbage collection
When running an FSDP model with FlopCounterMode, we are experiencing a memory leak. It is coming from ModuleTracker class. Even though ModuleTracker class is keeping weakrefrences of the operators, the tensors/operators are not being freed after the backward pass. To force free these tensors/operators after backwardpass, I explicitly added garbage collection in the post forward hook. (cherry picked from commit 63dc40d)
- Loading branch information