HierarchicalSampler is not passed as a batch_sampler parameter
Author: ManuelZCreated Sep 16, 2025Updated Sep 16, 2025
Labelsbug
I'm trying to use the MetricLossOnly trainer with the HierarchicalSampler, but it's inheriting from Sampler instead of from BatchSampler and due to this, the following block isn't executed.
And the training doesn't work because instead of getting a 4D tensor like b,c,h,w, I get b,b,c,h,w and an error.
I haven't digged further, but so far, the training seems to be working if I force the HierarchicalSampler to inherit from BatchSampler.
Why did you change it from BatchSampler to Sampler?
Thanks for this fantastic library!
Source: KevinMusgrave/pytorch-metric-learning