We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the DistributedBucketSampler class, it's possible that the first bucket has no elements and thus results in a Division by zero error.
DistributedBucketSampler
Division by zero
class DistributedBucketSampler(torch.utils.data.distributed.DistributedSampler): # ... def _create_buckets(self): buckets = [[] for _ in range(len(self.boundaries) - 1)] for i in range(len(self.lengths)): length = self.lengths[i] idx_bucket = self._bisect(length) if idx_bucket != -1: buckets[idx_bucket].append(i) # for i in range(len(buckets) - 1, 0, -1): for i in range(len(buckets) - 1, -1, -1): # here: changed the stopping index to -1 to allow pop(0) if len(buckets[i]) == 0: buckets.pop(i) self.boundaries.pop(i + 1) num_samples_per_bucket = [] for i in range(len(buckets)): len_bucket = len(buckets[i]) total_batch_size = self.num_replicas * self.batch_size rem = (total_batch_size - (len_bucket % total_batch_size)) % total_batch_size num_samples_per_bucket.append(len_bucket + rem) return buckets, num_samples_per_bucket # ...
Glad to discuss :)
The text was updated successfully, but these errors were encountered:
Thanks for pointing that out, I will research into that.
Actually, I had a idea to change the sampler technique for the future release
Sorry, something went wrong.
No branches or pull requests
In the
DistributedBucketSampler
class, it's possible that the first bucket has no elements and thus results in aDivision by zero
error.Glad to discuss :)
The text was updated successfully, but these errors were encountered: