2

This is probably a simple question, but how see how the contents of this standard data loader looks like:

from torchtext import datasets
import random

train_data, test_data = datasets.IMDB.splits(TEXT, LABEL)
train_data, valid_data = train_data.split(random_state = random.seed(SEED))

I can't use .head() and:

print(test_data)

just gives me:

<torchtext.datasets.imdb.IMDB object at 0x7f0b42e8c240>

I'm probably just missing .values or [0] or something similar...

dorien
  • 5,265
  • 10
  • 57
  • 116

1 Answers1

5

Datasets are iterables, you can get the first element with next(iter(test_data)).

nnnmmm
  • 7,964
  • 4
  • 22
  • 41