prateekjoshi565 / Fine-Tuning-BERT

Apache License 2.0
139 stars 119 forks source link

ValueError: too many dimensions 'str' #9

Open KazimTibetSar opened 3 years ago

KazimTibetSar commented 3 years ago

Hello,

for train set

train_seq = torch.tensor(tokens_train['input_ids'])
train_mask = torch.tensor(tokens_train['attention_mask'])
train_y = torch.tensor(train_labels.tolist())

at train_y an error occuring as; ValueError: too many dimensions 'str'

There is my train labels:

0

0 positive 1 negative 2 positive 3 notr 4 positive ... ... 4002 notr 4003 positive 4004 positive 4005 notr 4006 negative

can you help me about that issue x0 x0077-02

alankar66 commented 3 years ago

This error cause because of the datatype error Use this above the code:-

train_labels = train_labels.astype(int) val_labels = val_labels.astype(int) test_labels = test_labels.astype(int)