|
1 |
| -# Companion Jupyter notebooks for the book "Deep Learning with Python" (2025) |
| 1 | +# Companion notebooks for Deep Learning with Python |
2 | 2 |
|
3 |
| -This repository contains Jupyter notebooks implementing the code samples found in the book [Deep Learning with Python, third edition](https://www.manning.com/books/deep-learning-with-python-third-edition?a_aid=keras&a_bid=76564dff) |
4 |
| -by Francois Chollet and Matthew Watson. |
5 |
| - |
6 |
| -In addition, you will also find the legacy notebooks for the [second edition (2021)](https://www.manning.com/books/deep-learning-with-python-second-edition?a_aid=keras&a_bid=76564dff) |
| 3 | +This repository contains Jupyter notebooks implementing the code samples found in the book [Deep Learning with Python, third edition (2025)](https://www.manning.com/books/deep-learning-with-python-third-edition?a_aid=keras&a_bid=76564dff) |
| 4 | +by Francois Chollet and Matthew Watson. In addition, you will also find the legacy notebooks for the [second edition (2021)](https://www.manning.com/books/deep-learning-with-python-second-edition?a_aid=keras&a_bid=76564dff) |
7 | 5 | and the [first edition (2017)](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid=76564dff).
|
8 | 6 |
|
9 | 7 | For readability, these notebooks only contain runnable code blocks and section titles, and omit everything else in the book: text paragraphs, figures, and pseudocode.
|
10 | 8 | **If you want to be able to follow what's going on, I recommend reading the notebooks side by side with your copy of the book.**
|
11 | 9 |
|
| 10 | +## Running the code |
| 11 | + |
| 12 | +We recommend running these notebooks on [Colab](https://colab.google), which |
| 13 | +provides a hosted runtime with all the dependencies you will need. You can also, |
| 14 | +run these notebooks locally, either by setting up your own Jupyter environment, |
| 15 | +or using Colab's instructions for |
| 16 | +[running locally](https://research.google.com/colaboratory/local-runtimes.html). |
| 17 | + |
| 18 | +By default, all notebooks will run on Colab's free tier GPU runtime, which |
| 19 | +is sufficient to run all code in this book. Chapter 8-18 chapters will benefit |
| 20 | +from a faster GPU if you have a Colab Pro subscription. You can change your |
| 21 | +runtime type using **Runtime -> Change runtime type** in Colab's dropdown menus. |
| 22 | + |
| 23 | +## Choosing a backend |
| 24 | + |
| 25 | +The code for third edition is written using Keras 3. As such, it can be run with |
| 26 | +JAX, TensorFlow or PyTorch as a backend. To set the backend, update the backend |
| 27 | +in the cell at the top of the colab that looks like this: |
| 28 | + |
| 29 | +```python |
| 30 | +import os |
| 31 | +os.environ["KERAS_BACKEND"] = "jax" |
| 32 | +``` |
| 33 | + |
| 34 | +This must be done only once per session before importing Keras. If you are |
| 35 | +in the middle running a notebook, you will need to restart the notebook session |
| 36 | +and rerun all relevant notebook cells. This can be done in using |
| 37 | +**Runtime -> Restart Session** in Colab's dropdown menus. |
| 38 | + |
| 39 | +## Using Kaggle data |
| 40 | + |
| 41 | +This book uses datasets and model weights provided by Kaggle, an online Machine |
| 42 | +Learning community and platform. You will need to create a Kaggle login to run |
| 43 | +Kaggle code in this book; instructions are given in Chapter 8. |
| 44 | + |
| 45 | +For chapters that need Kaggle data, you can login to Kaggle once per session |
| 46 | +when you hit the notebook cell with `kagglehub.login()`. Alternately, |
| 47 | +you can set up your Kaggle login information once as Colab secrets: |
| 48 | + |
| 49 | + * Go to https://www.kaggle.com/ and sign in. |
| 50 | + * Go to https://www.kaggle.com/settings and generate a Kaggle API key. |
| 51 | + * Open the secrets tab in Colab by clicking the key icon on the left. |
| 52 | + * Add two secrets, `KAGGLE_USERNAME` and `KAGGLE_KEY` with the username and key |
| 53 | + you just created. |
| 54 | + |
| 55 | +Following this approach you will only need to copy your Kaggle secret key once, |
| 56 | +though you will need to allow each notebook to access your secrets when running |
| 57 | +the relevant Kaggle code. |
| 58 | + |
12 | 59 | ## Table of contents
|
13 | 60 |
|
14 | 61 | * [Chapter 2: The mathematical building blocks of neural networks](https://colab.research.google.com/github/fchollet/deep-learning-with-python-notebooks/blob/master/chapter02_mathematical-building-blocks.ipynb)
|
|
0 commit comments