Skip to content
Discussion options

You must be logged in to vote

Hi @Grimshinigami ,

Good question!

But this is one of the main reasons we don't shuffle the test_dataloader.

You can shuffle it if you like.

But as you've seen, this can cause confusion/errors when evaluating (due to different instances of the test data being in different orders).

In short, best practice is usually:

  • Shuffle training data (to prevent the model learning order during training)
  • Don't shuffle testing data

Code example:

from torch.utils.data import DataLoader

# Setup the batch size hyperparameter
BATCH_SIZE = 32

# Turn datasets into iterables (batches)
train_dataloader = DataLoader(train_data, # dataset to turn into iterable
    batch_size=BATCH_SIZE, # how many samples per…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Grimshinigami
Comment options

Answer selected by Grimshinigami
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants