Torchtext keep tokens in the same order
Both Iterator and BucketIterator should keep the order of tokens and only shuffle the sentences in the dataset.
You very likely have your input tensors in an incorrect shape. The default shapes in TorchText are: length × batch_size × features. If you have the batch first and sequence length the second, your sentences got shuffled.
I have a seq2seq neural network which I use for translating text. I need the sentences to remain the same during batches, more exactly, a sentence should be like an inseparable block of tokens. However, it looks like the iterators provided by Torchtext (BucketIterator and Iterator) do not keep the initial order of the tokens. Is there a solution to this, except of writing my own padding and batching functions?