I am following along a book about NLP in PyTorch but when i am running the last line, i got an error:
from torchtext import data, datasets

TEXT = data.Field(lower=True, batch_first=True, fix_length=20)
LABEL = data.Field(sequential=False)

train, test = datasets.IMDB.splits(TEXT, LABEL)

train.fields

from torchtext.vocab import GloVe

vars(train[0])

TEXT.build_vocab(train, vectors=GloVe(name='6B', dim=300), max_size=10000, min_freq = 10)

TEXT.vocab.freqs

TEXT.vocab.vectors[200]

# stoi -> string to index
TEXT.vocab.stoi

# itos -> index to string
TEXT.vocab.itos[50]

train_iter, test_iter = torchtext.data.BucketIterator.splits((train, test),
                                                            batch_size=128, shuffle=True)

batch = next(iter(train_iter))

error message:
AttributeError: 'Field' object has no attribute 'vocab'

but i am not entirely sure why since i have already build_vocab already right?