From 361a41935699ad27dbc9bd8db3d52ea6fc560d0e Mon Sep 17 00:00:00 2001 From: jalateras Date: Mon, 22 Sep 2025 11:43:05 +1000 Subject: [PATCH] docs: add missing directory creation step for going_modular Add os.makedirs step before first %%writefile command to ensure going_modular directory exists before writing Python scripts to it. This prevents FileNotFoundError when users follow the notebook. --- 05_pytorch_going_modular.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/05_pytorch_going_modular.md b/05_pytorch_going_modular.md index c9a17120..8d9cbd5e 100644 --- a/05_pytorch_going_modular.md +++ b/05_pytorch_going_modular.md @@ -246,7 +246,16 @@ data/ Once we've got data, we can then turn it into PyTorch `Dataset`'s and `DataLoader`'s (one for training data and one for testing data). -We convert the useful `Dataset` and `DataLoader` creation code into a function called `create_dataloaders()`. +First, we need to create the `going_modular` directory where we'll save all our Python scripts: + +```python +import os + +# Create the directory if it doesn't exist +os.makedirs('going_modular', exist_ok=True) +``` + +Now we can convert the useful `Dataset` and `DataLoader` creation code into a function called `create_dataloaders()`. And we write it to file using the line `%%writefile going_modular/data_setup.py`.