Skip to content

Commit 71614bd

Browse files
committed
Adding tutorial for data loaders on gpu with jax (#109)
1 parent 2bb53a7 commit 71614bd

File tree

6 files changed

+1845
-4
lines changed

6 files changed

+1845
-4
lines changed

docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
'JAX_transformer_text_classification.md',
6868
'data_loaders_on_cpu_with_jax.md',
6969
'data_loaders_for_multi_device_setups_with_jax.md',
70+
'data_loaders_on_gpu_with_jax.md',
7071
]
7172

7273
suppress_warnings = [
@@ -105,4 +106,5 @@
105106
'JAX_transformer_text_classification.ipynb',
106107
'data_loaders_on_cpu_with_jax.ipynb',
107108
'data_loaders_for_multi_device_setups_with_jax.ipynb',
109+
'data_loaders_on_gpu_with_jax.ipynb',
108110
]

docs/source/data_loaders_on_cpu_with_jax.ipynb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
"- [**Grain**](https://github.com/google/grain)\n",
2525
"- [**Hugging Face**](https://huggingface.co/docs/datasets/en/use_with_jax#data-loading)\n",
2626
"\n",
27-
"You'll see how to use each of these libraries to efficiently load data for a simple image classification task using the MNIST dataset."
27+
"In this tutorial, you'll learn how to efficiently load data using these libraries for a simple image classification task based on the MNIST dataset.\n",
28+
"\n",
29+
"Compared to GPU or multi-device setups, CPU-based data loading is straightforward as it avoids challenges like GPU memory management and data synchronization across devices. This makes it ideal for smaller-scale tasks or scenarios where data resides exclusively on the CPU.\n",
30+
"\n",
31+
"If you're looking for GPU-specific data loading advice, see [Data Loaders on GPU](https://jax-ai-stack.readthedocs.io/en/latest/data_loaders_on_gpu_with_jax.html).\n",
32+
"\n",
33+
"If you're looking for a multi-device data loading strategy, see [Data Loaders on Multi-Device Setups](https://jax-ai-stack.readthedocs.io/en/latest/data_loaders_for_multi_device_setups_with_jax.html)."
2834
]
2935
},
3036
{
@@ -1489,7 +1495,7 @@
14891495
"source": [
14901496
"## Summary\n",
14911497
"\n",
1492-
"This notebook has guided you through efficient methods for loading data on a CPU when using JAX. You’ve learned how to leverage popular libraries such as PyTorch DataLoader, TensorFlow Datasets, Grain, and Hugging Face Datasets to streamline the data loading process for your machine learning tasks. Each of these methods offers unique advantages and considerations, allowing you to choose the best approach based on the specific needs of your project."
1498+
"This notebook has introduced efficient strategies for data loading on a CPU with JAX, demonstrating how to integrate popular libraries like PyTorch DataLoader, TensorFlow Datasets, Grain, and Hugging Face Datasets. Each library offers distinct advantages, enabling you to streamline the data loading process for machine learning tasks. By understanding the strengths of these methods, you can select the approach that best suits your project's specific requirements."
14931499
]
14941500
}
14951501
],

docs/source/data_loaders_on_cpu_with_jax.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ This tutorial explores different data loading strategies for using **JAX** on a
2626
- [**Grain**](https://github.com/google/grain)
2727
- [**Hugging Face**](https://huggingface.co/docs/datasets/en/use_with_jax#data-loading)
2828

29-
You'll see how to use each of these libraries to efficiently load data for a simple image classification task using the MNIST dataset.
29+
In this tutorial, you'll learn how to efficiently load data using these libraries for a simple image classification task based on the MNIST dataset.
30+
31+
Compared to GPU or multi-device setups, CPU-based data loading is straightforward as it avoids challenges like GPU memory management and data synchronization across devices. This makes it ideal for smaller-scale tasks or scenarios where data resides exclusively on the CPU.
32+
33+
If you're looking for GPU-specific data loading advice, see [Data Loaders on GPU](https://jax-ai-stack.readthedocs.io/en/latest/data_loaders_on_gpu_with_jax.html).
34+
35+
If you're looking for a multi-device data loading strategy, see [Data Loaders on Multi-Device Setups](https://jax-ai-stack.readthedocs.io/en/latest/data_loaders_for_multi_device_setups_with_jax.html).
3036

3137
+++ {"id": "pEsb135zE-Jo"}
3238

@@ -682,4 +688,4 @@ train_model(num_epochs, params, hf_training_generator)
682688

683689
## Summary
684690

685-
This notebook has guided you through efficient methods for loading data on a CPU when using JAX. You’ve learned how to leverage popular libraries such as PyTorch DataLoader, TensorFlow Datasets, Grain, and Hugging Face Datasets to streamline the data loading process for your machine learning tasks. Each of these methods offers unique advantages and considerations, allowing you to choose the best approach based on the specific needs of your project.
691+
This notebook has introduced efficient strategies for data loading on a CPU with JAX, demonstrating how to integrate popular libraries like PyTorch DataLoader, TensorFlow Datasets, Grain, and Hugging Face Datasets. Each library offers distinct advantages, enabling you to streamline the data loading process for machine learning tasks. By understanding the strengths of these methods, you can select the approach that best suits your project's specific requirements.

0 commit comments

Comments
 (0)