Skip to content

Commit 66e1828

Browse files
committed
update_data_loading_on_cpu
1 parent aaaa5ed commit 66e1828

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

docs/data_loaders_on_cpu_with_jax.ipynb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"id": "PUFGZggH49zp"
77
},
88
"source": [
9-
"## Introduction to Data Loaders on CPU with JAX"
9+
"# Introduction to Data Loaders on CPU with JAX"
1010
]
1111
},
1212
{
@@ -15,6 +15,8 @@
1515
"id": "3ia4PKEV5Dr8"
1616
},
1717
"source": [
18+
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jax-ml/jax-ai-stack/blob/main/docs/data_loaders_on_cpu_with_jax.ipynb)\n",
19+
"\n",
1820
"This tutorial explores different data loading strategies for using **JAX** on a single [**CPU**](https://jax.readthedocs.io/en/latest/glossary.html#term-CPU). While JAX doesn't include a built-in data loader, it seamlessly integrates with popular data loading libraries, including:\n",
1921
"* [**PyTorch DataLoader**](https://github.com/pytorch/data)\n",
2022
"* [**TensorFlow Datasets (TFDS)**](https://github.com/tensorflow/datasets)\n",
@@ -262,7 +264,7 @@
262264
"id": "Hsionp5IYsQ9"
263265
},
264266
"source": [
265-
"## Loading Data with PyTorch DataLoader\n",
267+
"### Loading Data with PyTorch DataLoader\n",
266268
"\n",
267269
"This section shows how to load the MNIST dataset using PyTorch's DataLoader, convert the data to NumPy arrays, and apply transformations to flatten and cast images."
268270
]
@@ -614,7 +616,7 @@
614616
"id": "Nm45ZTo6yrf5"
615617
},
616618
"source": [
617-
"## Loading Data with TensorFlow Datasets (TFDS)\n",
619+
"### Loading Data with TensorFlow Datasets (TFDS)\n",
618620
"\n",
619621
"This section demonstrates how to load the MNIST dataset using TFDS, fetch the full dataset for evaluation, and define a training generator for batch processing. GPU usage is explicitly disabled for TensorFlow."
620622
]
@@ -816,7 +818,7 @@
816818
"id": "-ryVkrAITS9Z"
817819
},
818820
"source": [
819-
"## Loading Data with Grain\n",
821+
"### Loading Data with Grain\n",
820822
"\n",
821823
"This section demonstrates how to load MNIST data using Grain, a data-loading library. You'll define a custom dataset class for Grain and set up a Grain DataLoader for efficient training."
822824
]
@@ -1082,7 +1084,7 @@
10821084
"id": "oixvOI816qUn"
10831085
},
10841086
"source": [
1085-
"## Loading Data with Hugging Face\n",
1087+
"### Loading Data with Hugging Face\n",
10861088
"\n",
10871089
"This section demonstrates loading MNIST data using the Hugging Face `datasets` library. You'll format the dataset for JAX compatibility, prepare flattened images and one-hot-encoded labels, and define a training generator."
10881090
]

docs/data_loaders_on_cpu_with_jax.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ jupytext:
55
extension: .md
66
format_name: myst
77
format_version: 0.13
8-
jupytext_version: 1.16.4
8+
jupytext_version: 1.15.2
99
kernelspec:
1010
display_name: Python 3
1111
name: python3
1212
---
1313

1414
+++ {"id": "PUFGZggH49zp"}
1515

16-
## Introduction to Data Loaders on CPU with JAX
16+
# Introduction to Data Loaders on CPU with JAX
1717

1818
+++ {"id": "3ia4PKEV5Dr8"}
1919

20+
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jax-ml/jax-ai-stack/blob/main/docs/data_loaders_on_cpu_with_jax.ipynb)
21+
2022
This tutorial explores different data loading strategies for using **JAX** on a single [**CPU**](https://jax.readthedocs.io/en/latest/glossary.html#term-CPU). While JAX doesn't include a built-in data loader, it seamlessly integrates with popular data loading libraries, including:
2123
* [**PyTorch DataLoader**](https://github.com/pytorch/data)
2224
* [**TensorFlow Datasets (TFDS)**](https://github.com/tensorflow/datasets)
@@ -188,7 +190,7 @@ def train_model(num_epochs, params, training_generator, data_loader_type='stream
188190

189191
+++ {"id": "Hsionp5IYsQ9"}
190192

191-
## Loading Data with PyTorch DataLoader
193+
### Loading Data with PyTorch DataLoader
192194

193195
This section shows how to load the MNIST dataset using PyTorch's DataLoader, convert the data to NumPy arrays, and apply transformations to flatten and cast images.
194196

@@ -318,7 +320,7 @@ train_model(num_epochs, params, pytorch_training_generator(mnist_dataset), data_
318320

319321
+++ {"id": "Nm45ZTo6yrf5"}
320322

321-
## Loading Data with TensorFlow Datasets (TFDS)
323+
### Loading Data with TensorFlow Datasets (TFDS)
322324

323325
This section demonstrates how to load the MNIST dataset using TFDS, fetch the full dataset for evaluation, and define a training generator for batch processing. GPU usage is explicitly disabled for TensorFlow.
324326

@@ -413,7 +415,7 @@ train_model(num_epochs, params, training_generator)
413415

414416
+++ {"id": "-ryVkrAITS9Z"}
415417

416-
## Loading Data with Grain
418+
### Loading Data with Grain
417419

418420
This section demonstrates how to load MNIST data using Grain, a data-loading library. You'll define a custom dataset class for Grain and set up a Grain DataLoader for efficient training.
419421

@@ -547,7 +549,7 @@ train_model(num_epochs, params, pygrain_training_generator)
547549

548550
+++ {"id": "oixvOI816qUn"}
549551

550-
## Loading Data with Hugging Face
552+
### Loading Data with Hugging Face
551553

552554
This section demonstrates loading MNIST data using the Hugging Face `datasets` library. You'll format the dataset for JAX compatibility, prepare flattened images and one-hot-encoded labels, and define a training generator.
553555

0 commit comments

Comments
 (0)