You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this episode we will learn how use Keras to adapt a state-of-the-art pre-trained model to the [Dollar Street Dataset](https://zenodo.org/records/10970014).
32
32
33
+
::: spoiler
34
+
### Google Colab + GPUs recommended
35
+
This episode uses a respectably sized neural network — *DenseNet121*, which has 121 layers and over 7 million parameters. Training or "finetuning" this large of a model on a CPU is slow. Graphical Processing Units (GPUs) dramatically accelerate deep learning by speeding up the underlying matrix operations, often achieving **10-100x faster performance** than CPUs.
36
+
37
+
To speed things up, we recommend using [Google Colab](https://colab.research.google.com/), which provides free access to a GPU.
38
+
39
+
#### How to run this episode in Colab:
40
+
41
+
**A. Upload the `dl_workshop` folder to your Google Drive (excluding the `venv` folder).**
42
+
43
+
- This folder should contain the `data/` directory with the `.npy` files used in this episode. If the instructor has provided pre-filled notebooks for the workshop, please upload these as well. DO NOT UPLOAD your virtual environment folder as it is very large, and we'll be using Google Colab's pre-built environment instead.
44
+
45
+
**B. Start a blank notebook in Colab or open pre-filled notebook provided by instructor**
46
+
47
+
- Go to [https://colab.research.google.com/](https://colab.research.google.com/), click "New Notebook", and copy/paste code from this episode into cells.
48
+
49
+
**C. Enable GPU**
50
+
51
+
- Go to `Runtime > Change runtime type`
52
+
- Set "Hardware accelerator" to `GPU`
53
+
- Click "Save"
54
+
55
+
**D. Mount your Google Drive in the notebook:**
56
+
57
+
```python
58
+
from google.colab import drive
59
+
drive.mount('/content/drive')
60
+
```
61
+
**E. Set the data path to point to your uploaded folder, and load data:**
print("GPU not found. Training will use CPU and may be slow.")
82
+
```
83
+
84
+
```output
85
+
GPU is available and will be used.
86
+
```
87
+
88
+
Assuming you have installed the GPU-enabled version of TensorFlow (which is pre-installed in Colab), you don't need to do anything else to enable GPU usage during training, tuning, or inference. TensorFlow/Keras will automatically use the GPU whenever it's available and supported. Note — we didn't include the GPU version of Tensorflow in this workshop's virtual environment because it can be finnicky to configure across operating systems, and many learners don't have the appropriate GPU hardware available.
89
+
90
+
:::
91
+
33
92
34
93
## 1. Formulate / Outline the problem
35
94
@@ -41,7 +100,8 @@ We load the data in the same way as the previous episode:
41
100
import pathlib
42
101
import numpy as np
43
102
44
-
DATA_FOLDER= pathlib.Path('data/dataset_dollarstreet/') # change to location where you stored the data
103
+
# DATA_FOLDER = pathlib.Path('data/') # local path
0 commit comments