diff --git a/01_pytorch_workflow.ipynb b/01_pytorch_workflow.ipynb index 5f9527e..4df4e19 100644 --- a/01_pytorch_workflow.ipynb +++ b/01_pytorch_workflow.ipynb @@ -47,7 +47,7 @@ "\n", "| **Topic** | **Contents** |\n", "| ----- | ----- |\n", - "| **1. Getting data ready** | Data can be almost anything but for to get started we're going to create a simple straight line |\n", + "| **1. Getting data ready** | Data can be almost anything but to get started we're going to create a simple straight line |\n", "| **2. Building a model** | Here we'll create a model to learn patterns in the data, we'll also choose a **loss function**, **optimizer** and build a **training loop**. | \n", "| **3. Fitting the model to data (training)** | We've got data and a model, now let's let the model (try to) find patterns in the (**training**) data. |\n", "| **4. Making predictions and evaluating a model (inference)** | Our model's found patterns in the data, let's compare its findings to the actual (**testing**) data. |\n", @@ -79,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "id": "nGM1dEsYec0u" }, @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "id": "ZT_ikDC-ec0w", "colab": { @@ -174,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "id": "HmZWVNjGec0x", "outputId": "d66b47d1-5d0f-475d-b7fc-e0203b40b4e7", @@ -267,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "id": "BpyB7JgHec0y", "outputId": "bfb869bc-6bb8-46d9-b04b-955fc9435aa8", @@ -313,7 +313,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "id": "w9Ep0T-Dec0y" }, @@ -345,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "id": "xTaIwydGec0z", "outputId": "942373a8-177f-4d64-a690-f122bf34f42a", @@ -408,7 +408,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "id": "jhcUJBFuec00" }, @@ -487,7 +487,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "id": "CsEKA3A_ec01", "outputId": "23e0be11-ec5b-4ed1-f841-cb7a2292111b", @@ -531,7 +531,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "id": "XC1N_1Qrec01", "outputId": "cf218991-e9ca-4b50-d225-7f5d009bac51", @@ -590,7 +590,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "id": "-ITlZgU5ec02" }, @@ -627,7 +627,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "id": "k4xCScCvec02", "outputId": "206952e5-11f2-4a36-da90-7730b0ba5ddb", @@ -680,7 +680,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "id": "pwjxLWZTec02", "outputId": "c6a15b57-496c-4c68-a6a9-0a649501411f", @@ -781,7 +781,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "id": "P3T7hpNPec03" }, @@ -846,7 +846,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": { "id": "k1DfhyJ7ec03", "outputId": "dbcff926-2656-4045-cc0c-f128241930d7", @@ -953,7 +953,7 @@ "id": "FPXfvPLkau72", "outputId": "ec2c2dbf-febb-4d54-f91f-6ad4f9625ca0" }, - "execution_count": 15, + "execution_count": null, "outputs": [ { "output_type": "display_data", @@ -987,7 +987,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { "id": "Ci0W7kn5ec04", "outputId": "0839210e-2850-41f3-d2e4-456b90018e59", @@ -1056,7 +1056,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": { "id": "xKKxSBVuec05", "outputId": "7e0853ca-19cd-4e7c-ce2d-788d943d7d23", @@ -1111,7 +1111,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "metadata": { "id": "b_kBqpCfec05", "outputId": "f91890b8-88cc-45f1-fa87-ad7b42914737", @@ -1218,7 +1218,7 @@ "id": "qsQhY2S2jv90", "outputId": "126959cc-6985-435d-c1f0-4e593222adce" }, - "execution_count": 19, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -1231,7 +1231,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { "id": "mpQc45zwec06", "outputId": "33924469-b576-4f28-a49c-669fd1d55fad", @@ -1282,7 +1282,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "metadata": { "id": "1xnh3cFDec06", "outputId": "0fa62105-bf29-42a2-c428-2f82d9e3c98e", @@ -1337,7 +1337,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": { "id": "Ps-AuJqkec06" }, @@ -1362,7 +1362,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "metadata": { "id": "il9gqj6Nec06", "outputId": "cdc25943-67ae-42fb-9e83-c261f57b07d7", @@ -1451,7 +1451,7 @@ "id": "8hZ3CWhAIpUF", "outputId": "5fbcfad8-8bd7-49d3-faa3-bd52047d1c13" }, - "execution_count": 24, + "execution_count": null, "outputs": [ { "output_type": "execute_result", @@ -1480,7 +1480,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": { "id": "sx2Zpb5sec06", "outputId": "84eaaa0b-0d0d-4186-df61-078c179fdb56", @@ -1536,7 +1536,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "metadata": { "id": "fJqgDWUfec07", "outputId": "782443b7-8658-4db4-8e69-5dd45856645d", @@ -1605,7 +1605,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "metadata": { "id": "lQoo65evec07", "outputId": "3da2bcff-dac2-41a9-ca58-9d7c4a566850", @@ -1645,7 +1645,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "metadata": { "id": "gxhc0zCdec07", "outputId": "3fd83928-7f53-4cef-d895-c3beff00b0c7", @@ -1695,7 +1695,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "metadata": { "id": "6iOwqtFqec08", "outputId": "2a0aef9e-c464-4038-b906-01f3a99dc2ad", @@ -1755,7 +1755,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "metadata": { "id": "HhCvYNpAec08", "outputId": "f8a51543-3f00-4098-ee5e-f73ed0f5df3f", @@ -1793,7 +1793,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "metadata": { "id": "JfTYec5Rec08", "outputId": "192cf687-02fc-4abb-b488-016bd7e52315", @@ -1864,7 +1864,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "metadata": { "id": "ZRgqFKrNec09" }, @@ -1925,7 +1925,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "metadata": { "id": "JDOHzX8lec09", "outputId": "0b770292-6c7b-43e4-9846-1e1a4ca38d73", @@ -2011,7 +2011,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "metadata": { "id": "TP_tFn5rec09", "outputId": "7c2b01fd-4f38-40bb-d00c-1c1f17a80ff2", @@ -2072,7 +2072,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "metadata": { "id": "ksqG5N5Iec09", "outputId": "c553631d-85df-4937-99c2-45412e1c40b9", @@ -2126,7 +2126,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "metadata": { "id": "Z4dmfr2bec09", "outputId": "325a416d-6552-4f7f-9946-49f7513937db", @@ -2203,7 +2203,7 @@ "id": "DcQo4JqL7eSU", "outputId": "accd6ad2-c5ba-4566-cf71-d3efa88ea7e9" }, - "execution_count": 50, + "execution_count": null, "outputs": [ { "output_type": "stream", @@ -2227,7 +2227,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": null, "metadata": { "id": "jMnVHzf1ec0-", "outputId": "67a2e928-7efd-4669-9a5a-c8659c3bd5c5", @@ -2274,7 +2274,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": null, "metadata": { "id": "fYODT7ONec0_", "outputId": "0eae5d96-081f-4f41-fc8f-bfe550424570", @@ -2343,6 +2343,7 @@ "1. Create a straight line dataset using the linear regression formula (`weight * X + bias`).\n", " * Set `weight=0.3` and `bias=0.9` there should be at least 100 datapoints total. \n", " * Split the data into 80% training, 20% testing.\n", + " * Plot the training and testing data so it becomes visual.\n", "2. Build a PyTorch model by subclassing `nn.Module`. \n", " * Inside should be a randomly initialized `nn.Parameter()` with `requires_grad=True`, one for `weights` and one for `bias`. \n", " * Implement the `forward()` method to compute the linear regression function you used to create the dataset in 1. \n", @@ -2353,7 +2354,7 @@ " * Write a training loop to perform the appropriate training steps for 300 epochs.\n", " * The training loop should test the model on the test dataset every 20 epochs.\n", "4. Make predictions with the trained model on the test data.\n", - " * Visualize these predictions against the original training and testing data.\n", + " * Visualize these predictions against the original training and testing data (**note:** you may need to make sure the predictions are *not* on the GPU if you want to use non-CUDA-enabled libraries such as matplotlib to plot).\n", "5. Save your trained model's `state_dict()` to file.\n", " * Create a new instance of your model class you made in 2. and load in the `state_dict()` you just saved to it.\n", " * Perform predictions on your test data with the loaded model and confirm they match the original model predictions from 4.\n",