I was doing sentiment analysis,
import torch
from torchtext import data
from torchtext import datasets
import random
import numpy as np
SEED = 1234
torch.manual_seed(SEED)
torch.backends.cudnn.deterministic = True
TWEET = data.Field(tokenize = 'spacy', batch_first = True)
USERNAME = data.Field()
LABEL = data.LabelField(dtype = torch.float)
import pandas as pd
import os
train_data = pd.read_csv(r"D:\KONTOL\train.csv")
fields = {'tweet_text': ('tweet', TWEET), 'username': ('username', USERNAME), 'label': ('label',LABEL)}
train_data, valid_data, test_data = data.TabularDataset.splits(
path = 'D:\KONTOL',
train = 'train.csv',
validation = 'valid.csv',
test = 'test.csv',
format = 'csv',
fields = fields,
skip_header = False
)
from the data that I scraped, I added a label column and its contents (positive and negative) to my data. but when I call the label column, it doesn’t read and finds the following error:
ValueError: 'label' is not in list
is there a way to solve it? any help is extremly appreciated