In your tokenize
function, you can also add a line to convert your labels to ints:
def tokenize(batch):
tokenized_batch = tokenizer(batch['text'], padding=True, truncation=True, max_length=128)
tokenized_batch["labels"] = [str_to_int[label] for label in batch["labels"]]
return tokenized_batch
with str_to_int
your correspondence string label to int label.