Skip to content

Commit

Permalink
Feat: Update RandomSortishSampler reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
speedcell4 committed Nov 28, 2024
1 parent ec9fc60 commit afa10e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion torchglyph/data/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ def __iter__(self):

class RandomSortishSampler(_SortishSampler):
def __iter__(self):
idx, key, reverse = [], [], True
idx, key = [], []

if distributed.is_initialized():
reverse = distributed.get_rank() % 2 == 0
else:
reverse = True

while True:
for batch in self.ds.shuffle().iter(batch_size=self.section_size, drop_last_batch=False):
Expand Down

0 comments on commit afa10e3

Please sign in to comment.