Similar to #78 on github issue of torchtext.
!cat data/split_test.csv
Phrase,Sentiment
' tries to force its quirkiness upon the audience .,1
's not nearly enough that 's right,0
entered the bizarre realm,1
torch.__version__, torchtext.__version__
('0.4.0', '0.2.3')
PHRASE = data.Field(batch_first = True, lower = True)
SENTIMENT = data.LabelField(tensor_type=torch.double, batch_first = True, use_vocab = False, postprocessing=data.Pipeline(lambda x: float(x)))
fields = [('phrase', PHRASE), ('sentiment', SENTIMENT)]
train, valid, test = data.TabularDataset.splits(
path = 'data',
train = 'split_train.csv',
validation = 'split_valid.csv',
test = 'split_test.csv',
format = 'csv',
fields = fields,
skip_header = True
)
vars(train[0])
#output
{'phrase': ['likely', 'to', 'leave', 'a', 'lasting', 'impression'],
'sentiment': '3'}
i want it to be something like
{'phrase': ['likely', 'to', 'leave', 'a', 'lasting', 'impression'],
'sentiment': 3}
it doesn’t seem to work, or maybe im doing something wrong, i’d be happy to be corrected. Thanks in advance.