Predictive Hacks

How to Change Column Names in HuggingFace Datasets

If you would like to fine-tune a custom model with transformers, the name of the target column should be “label“. Let’s see how we can rename column names in HuggingFace Datasets,

import datasets
from datasets import load_dataset

# load the data
dataset = load_dataset('csv', data_files='my_data.csv')

# rename the column "target" to "label"
dataset = dataset .rename_column('target', 'label')

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Python

Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.

Python

Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s