diff --git a/01_pytorch_workflow.ipynb b/01_pytorch_workflow.ipynb index 489f990..99ea2de 100644 --- a/01_pytorch_workflow.ipynb +++ b/01_pytorch_workflow.ipynb @@ -840,7 +840,7 @@ "id": "aFcKCsPcRfnA" }, "source": [ - "### Creating a training loop in PyTorch\n", + "### Creating an optimization loop in PyTorch\n", "\n", "Woohoo! Now we've got a loss function and an optimizer, it's now time to create a **training loop** (and **testing loop**).\n", "\n", @@ -855,9 +855,16 @@ "![the unofficial pytorch optimization loop song](https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/01-pytorch-optimization-loop-song.png)\n", "*The unoffical PyTorch optimization loops song, a fun way to remember the steps in a PyTorch training (and testing) loop.*\n", "\n", - "There will be a fair bit of code but nothing we can't handle.\n", + "There will be a fair bit of code but nothing we can't handle.\n" + ] + }, + { + "cell_type": "markdown", + "source": [ "\n", - "Specifically for the training loop, we'll follow the following steps:\n", + "\n", + "### PyTorch training loop\n", + "For the training loop, we'll build the following steps:\n", "\n", "| Number | Step name | What does it do? | Code example |\n", "| ----- | ----- | ----- | ----- |\n", @@ -871,9 +878,19 @@ ">\n", "> And on the ordering of things, the above is a good default order but you may see slightly different orders, the only rule of thumb is to zero gradients (`optimizer.zero_grad`) *before* stepping them (`optimizer.step()`) and calculate the loss (`loss = ...`) *before* performing backpropagation on it (`loss.backward()`). Though there are exceptions to these, they are beyond the scope of the course.\n", "\n", - "![pytorch training loop annotated](https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/01-pytorch-training-loop-annotated.png)\n", + "![pytorch training loop annotated](https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/01-pytorch-training-loop-annotated.png)\n" + ], + "metadata": { + "id": "agXn72H-sgyd" + } + }, + { + "cell_type": "markdown", + "source": [ "\n", - "And a typical testing loop may contain the following steps:\n", + "### PyTorch testing loop\n", + "\n", + "As for the testing loop (evaluating our model), the typical steps include:\n", "\n", "| Number | Step name | What does it do? | Code example |\n", "| ----- | ----- | ----- | ----- |\n", @@ -886,7 +903,10 @@ "![pytorch annotated testing loop](https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/01-pytorch-testing-loop-annotated.png)\n", "\n", "Let's put all of the above together and train our model for 100 **epochs** (forward passes through the data) and we'll evaluate it every 10 epochs.\n" - ] + ], + "metadata": { + "id": "OXHDdlfjssDc" + } }, { "cell_type": "code", @@ -2424,6 +2444,7 @@ "collapsed_sections": [], "name": "01_pytorch_workflow.ipynb", "provenance": [], + "toc_visible": true, "include_colab_link": true }, "interpreter": {