Skip to content

Commit

Permalink
code formatting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
vlomonaco committed May 28, 2024
1 parent 5557b56 commit 2995a27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
21 changes: 11 additions & 10 deletions avalanche/evaluation/metrics/disk_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ def get_dir_size(self, path) -> float:
total_size = 0.0

if platform == "linux" or platform == "linux2":
total_size = float(subprocess.check_output(['du', '-sb', path]).split()[0].decode('utf-8')) / 1024
total_size = (
float(
subprocess.check_output(["du", "-sb", path])
.split()[0]
.decode("utf-8")
)
/ 1024
)
else:
for dirpath, dirnames, filenames in os.walk(path):
for f in filenames:
Expand Down Expand Up @@ -150,10 +157,7 @@ def __init__(self, paths_to_monitor):
Creates an instance of the minibatch Disk usage metric.
"""
super(MinibatchDiskUsage, self).__init__(
paths_to_monitor,
reset_at="iteration",
emit_at="iteration",
mode="train",
paths_to_monitor, reset_at="iteration", emit_at="iteration", mode="train"
)

def __str__(self):
Expand Down Expand Up @@ -195,10 +199,7 @@ def __init__(self, paths_to_monitor):
Creates an instance of the experience Disk usage metric.
"""
super(ExperienceDiskUsage, self).__init__(
paths_to_monitor,
reset_at="experience",
emit_at="experience",
mode="eval",
paths_to_monitor, reset_at="experience", emit_at="experience", mode="eval"
)

def __str__(self):
Expand Down Expand Up @@ -232,7 +233,7 @@ def disk_usage_metrics(
minibatch=False,
epoch=False,
experience=False,
stream=False
stream=False,
) -> List[DiskPluginMetric]:
"""
Helper method that can be used to obtain the desired set of
Expand Down
1 change: 1 addition & 0 deletions tests/evaluation/test_disk_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ def test_basic(self):
disk = DiskUsage()
disk.get_dir_size(".")


if __name__ == "__main__":
unittest.main()

0 comments on commit 2995a27

Please sign in to comment.