fix(data): fix sampler bug for single device (#22)
Browse filesCo-authored-by: liusongtao <[email protected]>
exps/example/yolox_voc/yolox_voc_s.py
CHANGED
@@ -58,11 +58,10 @@ class Exp(MyExp):
|
|
58 |
|
59 |
if is_distributed:
|
60 |
batch_size = batch_size // dist.get_world_size()
|
61 |
-
|
62 |
-
|
63 |
-
)
|
64 |
-
|
65 |
-
sampler = torch.utils.data.RandomSampler(self.dataset)
|
66 |
|
67 |
batch_sampler = YoloBatchSampler(
|
68 |
sampler=sampler,
|
|
|
58 |
|
59 |
if is_distributed:
|
60 |
batch_size = batch_size // dist.get_world_size()
|
61 |
+
|
62 |
+
sampler = InfiniteSampler(
|
63 |
+
len(self.dataset), seed=self.seed if self.seed else 0
|
64 |
+
)
|
|
|
65 |
|
66 |
batch_sampler = YoloBatchSampler(
|
67 |
sampler=sampler,
|
yolox/exp/yolox_base.py
CHANGED
@@ -121,11 +121,10 @@ class Exp(BaseExp):
|
|
121 |
|
122 |
if is_distributed:
|
123 |
batch_size = batch_size // dist.get_world_size()
|
124 |
-
|
125 |
-
|
126 |
-
)
|
127 |
-
|
128 |
-
sampler = torch.utils.data.RandomSampler(self.dataset)
|
129 |
|
130 |
batch_sampler = YoloBatchSampler(
|
131 |
sampler=sampler,
|
|
|
121 |
|
122 |
if is_distributed:
|
123 |
batch_size = batch_size // dist.get_world_size()
|
124 |
+
|
125 |
+
sampler = InfiniteSampler(
|
126 |
+
len(self.dataset), seed=self.seed if self.seed else 0
|
127 |
+
)
|
|
|
128 |
|
129 |
batch_sampler = YoloBatchSampler(
|
130 |
sampler=sampler,
|