|
24 | 24 | "- [**Grain**](https://github.com/google/grain)\n",
|
25 | 25 | "- [**Hugging Face**](https://huggingface.co/docs/datasets/en/use_with_jax#data-loading)\n",
|
26 | 26 | "\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)." |
28 | 34 | ]
|
29 | 35 | },
|
30 | 36 | {
|
|
40 | 46 | },
|
41 | 47 | {
|
42 | 48 | "cell_type": "code",
|
43 |
| - "execution_count": 1, |
| 49 | + "execution_count": null, |
44 | 50 | "metadata": {
|
45 | 51 | "id": "vqP6xyObC0_9"
|
46 | 52 | },
|
|
61 | 67 | },
|
62 | 68 | {
|
63 | 69 | "cell_type": "code",
|
64 |
| - "execution_count": 2, |
| 70 | + "execution_count": null, |
65 | 71 | "metadata": {
|
66 | 72 | "id": "tDJNQ6V-Dg5g"
|
67 | 73 | },
|
|
83 | 89 | },
|
84 | 90 | {
|
85 | 91 | "cell_type": "code",
|
86 |
| - "execution_count": 3, |
| 92 | + "execution_count": null, |
87 | 93 | "metadata": {
|
88 | 94 | "colab": {
|
89 | 95 | "base_uri": "https://localhost:8080/"
|
|
120 | 126 | },
|
121 | 127 | {
|
122 | 128 | "cell_type": "code",
|
123 |
| - "execution_count": 4, |
| 129 | + "execution_count": null, |
124 | 130 | "metadata": {
|
125 | 131 | "id": "qLNOSloFDka_"
|
126 | 132 | },
|
|
164 | 170 | },
|
165 | 171 | {
|
166 | 172 | "cell_type": "code",
|
167 |
| - "execution_count": 5, |
| 173 | + "execution_count": null, |
168 | 174 | "metadata": {
|
169 | 175 | "id": "bKIYPSkvD1QV"
|
170 | 176 | },
|
|
212 | 218 | },
|
213 | 219 | {
|
214 | 220 | "cell_type": "code",
|
215 |
| - "execution_count": 6, |
| 221 | + "execution_count": null, |
216 | 222 | "metadata": {
|
217 | 223 | "id": "sA0a06raEQfS"
|
218 | 224 | },
|
|
274 | 280 | },
|
275 | 281 | {
|
276 | 282 | "cell_type": "code",
|
277 |
| - "execution_count": 7, |
| 283 | + "execution_count": null, |
278 | 284 | "metadata": {
|
279 | 285 | "colab": {
|
280 | 286 | "base_uri": "https://localhost:8080/"
|
|
308 | 314 | },
|
309 | 315 | {
|
310 | 316 | "cell_type": "code",
|
311 |
| - "execution_count": 8, |
| 317 | + "execution_count": null, |
312 | 318 | "metadata": {
|
313 | 319 | "id": "kO5_WzwY59gE"
|
314 | 320 | },
|
|
322 | 328 | },
|
323 | 329 | {
|
324 | 330 | "cell_type": "code",
|
325 |
| - "execution_count": 9, |
| 331 | + "execution_count": null, |
326 | 332 | "metadata": {
|
327 | 333 | "id": "6f6qU8PCc143"
|
328 | 334 | },
|
|
356 | 362 | },
|
357 | 363 | {
|
358 | 364 | "cell_type": "code",
|
359 |
| - "execution_count": 10, |
| 365 | + "execution_count": null, |
360 | 366 | "metadata": {
|
361 | 367 | "colab": {
|
362 | 368 | "base_uri": "https://localhost:8080/"
|
|
486 | 492 | },
|
487 | 493 | {
|
488 | 494 | "cell_type": "code",
|
489 |
| - "execution_count": 11, |
| 495 | + "execution_count": null, |
490 | 496 | "metadata": {
|
491 | 497 | "id": "c9ZCJq_rzPck"
|
492 | 498 | },
|
|
509 | 515 | },
|
510 | 516 | {
|
511 | 517 | "cell_type": "code",
|
512 |
| - "execution_count": 12, |
| 518 | + "execution_count": null, |
513 | 519 | "metadata": {
|
514 | 520 | "id": "brlLG4SqGphm"
|
515 | 521 | },
|
|
522 | 528 | },
|
523 | 529 | {
|
524 | 530 | "cell_type": "code",
|
525 |
| - "execution_count": 13, |
| 531 | + "execution_count": null, |
526 | 532 | "metadata": {
|
527 | 533 | "colab": {
|
528 | 534 | "base_uri": "https://localhost:8080/"
|
|
560 | 566 | },
|
561 | 567 | {
|
562 | 568 | "cell_type": "code",
|
563 |
| - "execution_count": 14, |
| 569 | + "execution_count": null, |
564 | 570 | "metadata": {
|
565 | 571 | "id": "B-fES82EiL6Z"
|
566 | 572 | },
|
|
583 | 589 | },
|
584 | 590 | {
|
585 | 591 | "cell_type": "code",
|
586 |
| - "execution_count": 15, |
| 592 | + "execution_count": null, |
587 | 593 | "metadata": {
|
588 | 594 | "colab": {
|
589 | 595 | "base_uri": "https://localhost:8080/"
|
|
624 | 630 | },
|
625 | 631 | {
|
626 | 632 | "cell_type": "code",
|
627 |
| - "execution_count": 16, |
| 633 | + "execution_count": null, |
628 | 634 | "metadata": {
|
629 | 635 | "id": "sGaQAk1DHMUx"
|
630 | 636 | },
|
|
650 | 656 | },
|
651 | 657 | {
|
652 | 658 | "cell_type": "code",
|
653 |
| - "execution_count": 17, |
| 659 | + "execution_count": null, |
654 | 660 | "metadata": {
|
655 | 661 | "colab": {
|
656 | 662 | "base_uri": "https://localhost:8080/",
|
|
721 | 727 | },
|
722 | 728 | {
|
723 | 729 | "cell_type": "code",
|
724 |
| - "execution_count": 18, |
| 730 | + "execution_count": null, |
725 | 731 | "metadata": {
|
726 | 732 | "colab": {
|
727 | 733 | "base_uri": "https://localhost:8080/"
|
|
757 | 763 | },
|
758 | 764 | {
|
759 | 765 | "cell_type": "code",
|
760 |
| - "execution_count": 19, |
| 766 | + "execution_count": null, |
761 | 767 | "metadata": {
|
762 | 768 | "id": "vX59u8CqEf4J"
|
763 | 769 | },
|
|
785 | 791 | },
|
786 | 792 | {
|
787 | 793 | "cell_type": "code",
|
788 |
| - "execution_count": 20, |
| 794 | + "execution_count": null, |
789 | 795 | "metadata": {
|
790 | 796 | "colab": {
|
791 | 797 | "base_uri": "https://localhost:8080/"
|
|
835 | 841 | },
|
836 | 842 | {
|
837 | 843 | "cell_type": "code",
|
838 |
| - "execution_count": 21, |
| 844 | + "execution_count": null, |
839 | 845 | "metadata": {
|
840 | 846 | "colab": {
|
841 | 847 | "base_uri": "https://localhost:8080/"
|
|
887 | 893 | },
|
888 | 894 | {
|
889 | 895 | "cell_type": "code",
|
890 |
| - "execution_count": 22, |
| 896 | + "execution_count": null, |
891 | 897 | "metadata": {
|
892 | 898 | "id": "mS62eVL9Ifmz"
|
893 | 899 | },
|
|
911 | 917 | },
|
912 | 918 | {
|
913 | 919 | "cell_type": "code",
|
914 |
| - "execution_count": 23, |
| 920 | + "execution_count": null, |
915 | 921 | "metadata": {
|
916 | 922 | "id": "bnrhac5Hh7y1"
|
917 | 923 | },
|
|
945 | 951 | },
|
946 | 952 | {
|
947 | 953 | "cell_type": "code",
|
948 |
| - "execution_count": 24, |
| 954 | + "execution_count": null, |
949 | 955 | "metadata": {
|
950 | 956 | "id": "pN3oF7-ostGE"
|
951 | 957 | },
|
|
965 | 971 | },
|
966 | 972 | {
|
967 | 973 | "cell_type": "code",
|
968 |
| - "execution_count": 25, |
| 974 | + "execution_count": null, |
969 | 975 | "metadata": {
|
970 | 976 | "id": "f1VnTuX3u_kL"
|
971 | 977 | },
|
|
983 | 989 | },
|
984 | 990 | {
|
985 | 991 | "cell_type": "code",
|
986 |
| - "execution_count": 26, |
| 992 | + "execution_count": null, |
987 | 993 | "metadata": {
|
988 | 994 | "colab": {
|
989 | 995 | "base_uri": "https://localhost:8080/"
|
|
1019 | 1025 | },
|
1020 | 1026 | {
|
1021 | 1027 | "cell_type": "code",
|
1022 |
| - "execution_count": 27, |
| 1028 | + "execution_count": null, |
1023 | 1029 | "metadata": {
|
1024 | 1030 | "id": "9RuFTcsCs2Ac"
|
1025 | 1031 | },
|
|
1051 | 1057 | },
|
1052 | 1058 | {
|
1053 | 1059 | "cell_type": "code",
|
1054 |
| - "execution_count": 28, |
| 1060 | + "execution_count": null, |
1055 | 1061 | "metadata": {
|
1056 | 1062 | "colab": {
|
1057 | 1063 | "base_uri": "https://localhost:8080/"
|
|
1101 | 1107 | },
|
1102 | 1108 | {
|
1103 | 1109 | "cell_type": "code",
|
1104 |
| - "execution_count": 29, |
| 1110 | + "execution_count": null, |
1105 | 1111 | "metadata": {
|
1106 | 1112 | "colab": {
|
1107 | 1113 | "base_uri": "https://localhost:8080/"
|
|
1187 | 1193 | },
|
1188 | 1194 | {
|
1189 | 1195 | "cell_type": "code",
|
1190 |
| - "execution_count": 30, |
| 1196 | + "execution_count": null, |
1191 | 1197 | "metadata": {
|
1192 | 1198 | "id": "8v1N59p76zn0"
|
1193 | 1199 | },
|
|
1209 | 1215 | },
|
1210 | 1216 | {
|
1211 | 1217 | "cell_type": "code",
|
1212 |
| - "execution_count": 31, |
| 1218 | + "execution_count": null, |
1213 | 1219 | "metadata": {
|
1214 | 1220 | "colab": {
|
1215 | 1221 | "base_uri": "https://localhost:8080/",
|
|
1376 | 1382 | },
|
1377 | 1383 | {
|
1378 | 1384 | "cell_type": "code",
|
1379 |
| - "execution_count": 32, |
| 1385 | + "execution_count": null, |
1380 | 1386 | "metadata": {
|
1381 | 1387 | "colab": {
|
1382 | 1388 | "base_uri": "https://localhost:8080/"
|
|
1427 | 1433 | },
|
1428 | 1434 | {
|
1429 | 1435 | "cell_type": "code",
|
1430 |
| - "execution_count": 33, |
| 1436 | + "execution_count": null, |
1431 | 1437 | "metadata": {
|
1432 | 1438 | "id": "-zLJhogj7RL-"
|
1433 | 1439 | },
|
|
1453 | 1459 | },
|
1454 | 1460 | {
|
1455 | 1461 | "cell_type": "code",
|
1456 |
| - "execution_count": 34, |
| 1462 | + "execution_count": null, |
1457 | 1463 | "metadata": {
|
1458 | 1464 | "colab": {
|
1459 | 1465 | "base_uri": "https://localhost:8080/"
|
|
1489 | 1495 | "source": [
|
1490 | 1496 | "## Summary\n",
|
1491 | 1497 | "\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." |
1493 | 1499 | ]
|
1494 | 1500 | }
|
1495 | 1501 | ],
|
1496 | 1502 | "metadata": {
|
1497 | 1503 | "colab": {
|
1498 |
| - "name": "data_loaders_on_cpu_with_jax.ipynb", |
1499 | 1504 | "provenance": []
|
1500 | 1505 | },
|
1501 | 1506 | "jupytext": {
|
|
0 commit comments