TensorFlow Datasets (TFDS) is a library that provides a comprehensive collection of ready-to-use datasets for machine learning frameworks like TensorFlow, JAX, and PyTorch. It handles the complexities of downloading, preparing, and constructing data into `tf.data.Dataset` or `np.array` objects in a deterministic manner, enabling easy-to-use and high-performance input pipelines. The library maintains an active release cadence, with stable versions typically released every few months, alongside daily nightly builds.
pip install tensorflow-datasetsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load the MNIST dataset using `tfds.load()`, retrieve training and testing splits, and configure a basic TensorFlow `tf.data.Dataset` input pipeline. It also shows how to inspect dataset metadata and iterate through a sample batch.
Review code that loads Hugging Face datasets and explicitly handle `None` values or convert `min` values if the old `0` behavior is desired.
For non-TensorFlow users, ensure you only use `tfds.as_numpy()` or PyTorch/JAX specific integrations. For TensorFlow users, ensure `tensorflow` is installed if using `tf.data` pipelines, even if not strictly required by TFDS for basic dataset loading.
Consider using a virtual environment to manage `apache-beam` versions specific to your `tensorflow-datasets` project, or explicitly downgrade `apache-beam` if conflicts arise.
If deterministic order is required, do not use the `--nondeterministic_order` flag. Implement explicit shuffling in your `tf.data` pipeline if randomized order is needed for training, rather than relying on generation-time shuffling.
Consult the official `CroissantBuilder` documentation for the updated API and adjust your dataset generation scripts accordingly.
Always specify `split` when loading or iterate over the dictionary to access specific splits. Use `as_supervised=True` for supervised learning tasks to get `(feature, label)` tuples, or `tfds.as_numpy()` to convert to NumPy arrays.
pip install tensorflow-datasets
Verify the dataset name against the official TFDS catalog (tfds.tensorflow.org/catalog) and ensure `tensorflow-datasets` is updated (`pip install --upgrade tensorflow-datasets`). For example, `tfds.load('mnist')`.Check your internet connection. Try clearing the TFDS download cache (`rm -rf ~/tensorflow_datasets/downloads/` or `tfds.core.constants.DATA_DIR`) and re-run. Consider upgrading TFDS (`pip install --upgrade tensorflow-datasets`).
Consult the dataset's documentation on the TFDS catalog website (tfds.tensorflow.org) to find available splits, or inspect them programmatically using `tfds.builder('dataset_name').info.splits`. For example, use `'train'` or `'test'` instead.Verify the dataset name from official TFDS documentation or by using `tfds.list_builders()` to see available datasets.