Skip to content

Commit dc2bc11

Browse files
committed
Log time to perform epoch shuffle
1 parent b2130d9 commit dc2bc11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/training/custom_sampler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import torch.distributed as dist
33
from torch.utils.data import Sampler, Dataset, Subset
44

5+
import wandb
6+
from time import time
57
from src.util.cases import Case
68

79

@@ -40,9 +42,11 @@ def __init__(self, dataset: Dataset, case: Case, seed: int = 0) -> None:
4042
def __iter__(self):
4143
# local vs. no-shuffle
4244
if self.case.shuffle:
45+
start = time()
4346
indices = torch.randperm(
4447
len(self.dataset), generator=self.generator
4548
).tolist()
49+
wandb.log({"epoch_shuffle_time": time() - start})
4650
else:
4751
indices = self.indices
4852

0 commit comments

Comments
 (0)