Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
  • Loading branch information
akoumpa committed Oct 1, 2024
1 parent 575da4b commit 5e47809
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nemo/lightning/pytorch/callbacks/memory_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, dir: str = "/mem_profile", warn_cycles=True, ranks=[], interv

self.dir = dir
self.ranks = ranks
assert isinstance(self.interval, int), "Expected interval to be an integer"
self.interval = interval
self.step = 0

Expand Down Expand Up @@ -87,7 +88,7 @@ def _dump_memory_snapshot(self, _snapshot_path=None, rank=None):

def on_train_batch_start(self, trainer, pl_module, batch, batch_idx, unused=0) -> None:
# It's disabled
if self.interval is None or self.interval <= 0:
if self.interval <= 0:
return
if self.step % self.interval == 0:
if self.enable_on_rank():
Expand Down

0 comments on commit 5e47809

Please sign in to comment.