You can always write your own Dataset and Sampler to accommodate your needs. For example, here 8 I wrote one that ensures that all sequences in a batch have the same length.
Apart from that, why would you want to do that? Is there any reasons to have all sentences in one document together as batch. Having batches of (very) different sizes can also be problematic. With larger batches you can have higher learning rates which can be problematic for smaller batches. That’s because the more samples you have in a batch, the more the gradients average out. See this paper 1.