I built the the vocab using torchtext and GloVe representation. My dataset consisted of Tweet and the Target (Hilary Clinton, Climate Change, Atheism etc) and I wanted to print those again after creating the iterator but I got a weird output.
TEXT.build_vocab(trn, min_freq = 2, vectors=GloVe(name='6B', dim=300))
vectors=GloVe(name='6B', dim=300)
train_iterator, test_iterator = BucketIterator.splits((trn,tst), batch_size= Batch_size, device = device)
for i,batch in enumerate(train_iterator):
x = batch.target.numpy()
l = []
for i in x.T:
for j in i:
l.append(vectors.itos[j])
#print(vectors.itos[j])
print(l)
break
[‘.’, ‘on’, ‘with’, ‘of’, ‘,’, ‘,’, ‘,’, ‘,’]
[‘.’, ‘said’, ‘it’, ‘of’, ‘,’, ‘,’, ‘,’, ‘,’]
[‘.’, ‘said’, ‘it’, ‘of’, ‘,’, ‘,’, ‘,’, ‘,’]
[‘.’, ‘said’, ‘it’, ‘of’, ‘,’, ‘,’, ‘,’, ‘,’]
[‘.’, ‘said’, ‘it’, ‘of’, ‘,’, ‘,’, ‘,’, ‘,’]
[‘.’, ‘on’, ‘with’, ‘of’, ‘,’, ‘,’, ‘,’, ‘,’]
[‘.’, ‘by’, ‘"’, ‘is’, ‘of’, ‘,’, ‘,’, ‘,’]
I got this instead of the targets, What is wrong with the code? or will it simply be like this?