Skip to main content

hf-dataset-slow-disk

A Hugging Face-style Parquet dataset library for HDDs, network filesystems, and other slow storage.

Features

  • Sequential row-group reads with bounded memory
  • Lazy background download and audio decoding
  • Standard Hugging Face Hub Parquet cache
  • Resumable general metadata cache with visible progress logs
  • Deterministic shuffle, epochs, and exact batch resume
  • Sample-mixed concatenation with one shared worker pipeline

Install

pip install hf-dataset-slow-disk

Quick start

from hf_dataset_slow_disk import load_dataset

dataset = load_dataset(
    "capleaf/viVoice",
    split="train",
    batch_size=8,
    num_workers=2,
).shuffle(seed=42)

dataset.set_epoch(0)

try:
    for batch in dataset:
        train_step(batch)
finally:
    dataset.close()

Workers start lazily on the first get() or when dataset iteration begins. Defaults are one worker, an eight-batch decoded buffer, and a two-file Parquet buffer.

An optional process-pickleable collate_fn(batch) runs on decoded column-oriented batches inside each background worker. It must preserve column names, order, and row count, allowing CPU preprocessing to overlap model execution.

Core API

from hf_dataset_slow_disk import (
    Audio,
    ConcatDataset,
    Dataset,
    DatasetDict,
    concatenate_datasets,
    load_dataset,
)
  • load_dataset() loads Hub or local Parquet data.
  • shuffle(seed) and set_epoch(epoch) select deterministic order.
  • set_batch_idx(batch_idx) restores the next training batch.
  • for batch in dataset, get(), and iter_batches() consume batches.
  • iter_rows() performs synchronous sample-by-sample iteration.
  • repeat=N intentionally repeats each chunk N times before shuffle, useful for balancing an underrepresented source before concatenation.
  • concatenate_datasets() mixes compatible sources with their configured weights.
  • cast_column() configures lazy audio decoding.

Documentation

Examples

uv run python examples/basic.py
uv run python examples/benchmark.py
uv run python examples/concat.py

The benchmark and concat examples use batch size 8 and stop after 10 batches.

Disclaimer

This project was developed with the assistance of AI coding tools. Its source code is publicly available at giangndm/hf-dataset-slow-disk. Please review and validate it for your own workloads before production use.

Development

uv sync
uv run pytest -q
uv build

Metadata

Release files for hf-dataset-slow-disk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hf-dataset-slow-disk 0.2.1
File Size Uploaded Provenance Actions
hf_dataset_slow_disk-0.2.1.tar.gz 88.2 kB Without provenance Details for hf_dataset_slow_disk-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hf-dataset-slow-disk 0.2.1
File Interpreter ABI Platform Actions
hf_dataset_slow_disk-0.2.1-py3-none-any.whl Python 3 none any Details for hf_dataset_slow_disk-0.2.1-py3-none-any.whl

Total release size: 114.2 kB

Release files / hf_dataset_slow_disk-0.2.1.tar.gz

Download URL hf_dataset_slow_disk-0.2.1.tar.gz
Size 88.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e3a0c1eadf049a503205d4fc82d3aff7dc1d58e145707bd8a365b84e79c0b8e2
BLAKE2b-256 checksum
How to use checksums
09a432385d5fef99a96fb3a77bc3df9bd4e3d2ef27ff0aea4e9098d4b1591e50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release files / hf_dataset_slow_disk-0.2.1-py3-none-any.whl

Download URL hf_dataset_slow_disk-0.2.1-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fb898188524656d88d230ce3e3578cb86c4bae8cf612d5388696f26786b4b9d
BLAKE2b-256 checksum
How to use checksums
33478acf9d1cabdaa2562b5e1b9fcce168ceb57ea86fba854731773370d1d37d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Security for hf-dataset-slow-disk 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page