Dataloader to make batch to minimize padding

Hi,
I am using DataSet and DataLoader class to load batches. How can I make this behave like BuckeIterator from torchtext ?

BuckeIterator load data of almost the same size to create each batch to minimize padding.