Skip to content

Commit 0bd637a

Browse files
committed
fix: sequential sampler take is capped by original size
1 parent 24f89b7 commit 0bd637a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

datastream/samplers/sequential_sampler.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ def __iter__(self):
2323
return iter(self.sampler)
2424

2525
def sample_proportion(self, proportion):
26-
sampler = SequentialSampler(int(len(self) * proportion))
27-
return sampler
26+
return SequentialSampler(min(
27+
len(self),
28+
int(len(self) * proportion)
29+
))

0 commit comments

Comments
 (0)