This happens because the dataset iterator from torchtext tries to sort the dataset, which implies comparing two elements.
Apparently this is a known “feature” and you have to provide a sorting function to the constructor of the BucketIterator, as seen in this issue 585.