Machine Learning, AI, NLP, Programming, Deep Dives.
LabelEncoder label_encoder = LabelEncoder() label_encoder.fit(dataset['train']['label']) def encode_labels(example): return {'encoded_label': label_encoder.transform([example['label']])[0]} for split in dataset: dataset[split] = dataset[split].map(encode_labels, batched=False) Then we need to map