tensorflow / tensorflow/datasets

Parallel shard writer

Open
#856 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

contributions welcome enhancement
Dominant language
Python
Stars
4.6k
Forks
1.6k
Avg merge
3h 54m
Merged PRs (30d)
1

Description

Currently, we write all shards sequentially to disk when creating TFRecord files from a downloaded dataset. This makes it very slow for datasets like quickdraw_bitmap, which is only ~36GB to download but takes my work system (on a HPC cluster) about 14 hours to fully prepare (at 1000 records/second).

Could _TFRecordWriter (https://github.com/tensorflow/datasets/blob/master/tensorflow_datasets/core/tfrecords_writer.py#L38) use multiprocessing to simultaneously write to the shards and ensure the process is blocking on I/O and not CPU?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tensorflow_datasets/core/tfrecords_writer.py at _TFRecordWriter and trace how shards are currently written. Measure the sequential write path for a large dataset such as quickdraw_bitmap, then determine how multiprocessing would preserve blocking behavior and shard correctness. Done means shard creation is concurrent and the preparation time improves without changing the generated TFRecord data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.