Help with tokenize_labels

I keep getting the error TypeError: unsupported operand type(s) for -: ‘list’ and ‘int’ and not sure how to fix

[code removed - moderator]

Use the local variable label_tokenizer inside the function. Don’t use tokenizer

I switched it to this:

[code removed - moderator]

but it won’t work

This code is correct. Could you save your notebook, restart the kernel and run all the cells once again?
There’s no need to set the dtype

I you still have problems, please click my name and message your notebook as an attachment.

The problem comes from this line in function train_val_split

validation_labels = sentences[train_size:]

You should slice labels and not sentences

1 Like