Hugging Face · Datasets

Transform every row

Apply a function to the dataset, in batches for speed.

ds = ds.map(lambda batch: tokenizer(batch["text"], truncation=True), batched=True)

Official Hugging Face documentation

More datasets commands

All datasets commands · Hugging Face cheatsheet

Was this page helpful?