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)andset_epoch(epoch)select deterministic order.set_batch_idx(batch_idx)restores the next training batch.for batch in dataset,get(), anditer_batches()consume batches.iter_rows()performs synchronous sample-by-sample iteration.concatenate_datasets()mixes compatible sources without oversampling.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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hf_dataset_slow_disk-0.1.2.tar.gz.
File metadata
- Download URL: hf_dataset_slow_disk-0.1.2.tar.gz
- Upload date:
- Size: 85.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77551b548b274d2a790b7163ea80c4b0a720417038827d74494c7ae9d9a981b6
|
|
| MD5 |
a5c33b7e4011c31cb456fd4e0596772d
|
|
| BLAKE2b-256 |
972adb919608fa907a6e84ba8784f80770645168fbbcd7e86c3b1044cfdb8dec
|
File details
Details for the file hf_dataset_slow_disk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: hf_dataset_slow_disk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03d2ec0d6042a07ca6e825e2288526b26af23b3ff666a71b81081c6b37fd592e
|
|
| MD5 |
60b9710e1f18f3a7ece8f4c7bb3ea823
|
|
| BLAKE2b-256 |
572ed332f8dfe7bc3d82f1f4b97c6083cd2d2fd8d8b37925da46c3ae602447c2
|