dataset-processing-multiprocessing

Distribute HuggingFace dataset tokenization, packing, and merging across CPU processes.

9|Updated Aug 8, 2023
One-click install
npx skills add https://github.com/anhvth/speedy_utils --skill dataset-processing-multiprocessing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dataset-processing-multiprocessing
Source: https://github.com/anhvth/speedy_utils/tree/main/.github/skills/dataset-processing-multiprocessing
Command: npx skills add https://github.com/anhvth/speedy_utils --skill dataset-processing-multiprocessing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Large dataset preprocessing often becomes a bottleneck due to memory constraints and sequential processing. This Skill enables safe, parallelized handling of tokenization, packing, and merging for big HuggingFace datasets.

Core Features & Use Cases

  • Distributed sharding across CPU cores to maximize throughput while keeping workers isolated.
  • End-to-end data prep pipeline: load, shard, tokenize, pack, and merge into a final dataset.
  • Use Case: preprocess and tokenize multi-GB datasets for model pretraining with robust error handling and incremental saves.

Quick Start

Run the example_tokenize_pack.py script with your source dataset path and a tokenizer to start end-to-end processing.

Frequently Asked Questions about dataset-processing-multiprocessing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I tokenize large HuggingFace datasets in parallel?

You tokenize large HuggingFace datasets in parallel by distributing CPU-bound preprocessing tasks across multiple isolated workers. This Skill shards the dataset, processes tokenization concurrently, and merges the results safely using temporary file management.

What is the best way to speed up data preparation for model pretraining?

The best way to speed up data preparation for model pretraining is to use distributed sharding across CPU cores. This Skill maximizes throughput by isolating workers for tokenization and packing, handling multi-GB datasets with robust error handling.

Can I use multiprocessing for HuggingFace dataset packing and merging?

Yes, you can use multiprocessing for HuggingFace dataset packing and merging. The Skill provides an end-to-end pipeline that loads, shards, tokenizes, packs, and merges datasets into a final output with incremental saves.

Do I need speedy_utils to run the dataset preprocessing pipeline?

Yes, you need the speedy_utils multi_process backend to run the dataset preprocessing pipeline. It provides the underlying multiprocessing infrastructure required to distribute heavy tokenization and packing workflows safely.

How does this approach handle errors during multi-GB dataset preprocessing?

This approach handles errors during multi-GB dataset preprocessing with robust error handling and incremental saves. Workers remain isolated, and safe temporary file management ensures data integrity if a failure occurs during tokenization or merging.

When should I not use multiprocessing for HuggingFace dataset tokenization?

You should not use multiprocessing for HuggingFace dataset tokenization if your workflow is I/O-bound rather than CPU-bound. This Skill targets CPU-bound tasks like tokenization and packing, where distributing shards across cores provides measurable throughput gains.