Skip to content

Commit

Permalink
protect ByteCounter (#10300)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitgr7 authored Nov 2, 2021
1 parent 3cd65b5 commit f44b8a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytorch_lightning/utilities/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from pytorch_lightning.utilities.apply_func import apply_to_collection


class ByteCounter:
class _ByteCounter:
"""Accumulate and stores the total bytes of an object."""

def __init__(self) -> None:
Expand Down Expand Up @@ -184,7 +184,7 @@ def get_model_size_mb(model: Module) -> float:
Returns:
Number of megabytes in the parameters of the input module.
"""
model_size = ByteCounter()
model_size = _ByteCounter()
torch.save(model.state_dict(), model_size)
size_mb = model_size.nbytes / 1e6
return size_mb

0 comments on commit f44b8a7

Please sign in to comment.