Based on the error message it seems you are dealing with variable sequence lengths.
The collate_fn of the DataLoader tries to stack the samples into a single batch, which would fail if the dimensions (besides the batch dim) don’t have the same shape. You could e.g. pad the smaller sequences to the largest sequence length in the batch to be able to create a full batch.