Merge pull request #3 from mrdbourke/v0

update main with course additions
This commit is contained in:
Daniel Bourke authored and GitHub committed 2021-10-20 15:48:47 +10:00
commit 7215148d91
4 files changed
+551 -25

No files matched your search

+230 -25
View File
@@ -16,6 +16,8 @@
"id": "jSNK7duj5SeU"
},
"source": [
"# 00. PyTorch Fundamentals\n",
"\n",
"# TK - intro to PyTorch\n",
"\n",
"## TK - What is PyTorch?\n",
@@ -899,7 +901,7 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -914,19 +916,20 @@
"tensor([1, 2, 3])"
]
},
"execution_count": 50,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"tensor = torch.tensor([1, 2, 3])\n",
"tensor"
]
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 3,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -941,7 +944,7 @@
"tensor(14)"
]
},
"execution_count": 51,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@@ -952,7 +955,7 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -967,7 +970,7 @@
"tensor(14)"
]
},
"execution_count": 54,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -978,7 +981,7 @@
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -993,7 +996,7 @@
"tensor(14)"
]
},
"execution_count": 58,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -1004,7 +1007,7 @@
},
{
"cell_type": "code",
"execution_count": 60,
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -1019,7 +1022,7 @@
"tensor(14)"
]
},
"execution_count": 60,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -1034,7 +1037,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
@@ -1046,12 +1049,12 @@
"outputs": [
{
"ename": "RuntimeError",
"evalue": "ignored",
"evalue": "mat1 and mat2 shapes cannot be multiplied (3x2 and 3x2)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-66-823bb99b3dae>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m [11, 12]], dtype=torch.float32)\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmatmul\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtensor_A\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtensor_B\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/tmp/ipykernel_34033/854767186.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 8\u001b[0m [11, 12]], dtype=torch.float32)\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmatmul\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtensor_A\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtensor_B\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m: mat1 and mat2 shapes cannot be multiplied (3x2 and 3x2)"
]
}
@@ -1071,7 +1074,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -1088,7 +1091,7 @@
" [ 83., 105., 127.]])"
]
},
"execution_count": 67,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
@@ -1097,6 +1100,29 @@
"torch.matmul(tensor_A, tensor_B.T)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[ 23., 29., 35.],\n",
" [ 53., 67., 81.],\n",
" [ 83., 105., 127.]])"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# torch.mm is a shortcut for matmul\n",
"torch.mm(tensor_A, tensor_B.T)"
]
},
{
"cell_type": "code",
"execution_count": 79,
@@ -1422,7 +1448,7 @@
},
{
"cell_type": "code",
"execution_count": 107,
"execution_count": 16,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -1437,19 +1463,20 @@
"tensor([1., 2., 3., 4., 5., 6., 7.])"
]
},
"execution_count": 107,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"x = torch.arange(1., 8.)\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 115,
"execution_count": 17,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -1464,7 +1491,7 @@
"(tensor([[1., 2., 3., 4., 5., 6., 7.]]), torch.Size([1, 7]))"
]
},
"execution_count": 115,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
@@ -1477,7 +1504,52 @@
},
{
"cell_type": "code",
"execution_count": 123,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(tensor([[1., 2., 3., 4., 5., 6., 7.]]), torch.Size([1, 7]))"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Change view (keeps same data as original but changes view)\n",
"# See more: https://stackoverflow.com/a/54507446/7900723\n",
"z = x.view(1, 7)\n",
"z, z.shape"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(tensor([[5., 2., 3., 4., 5., 6., 7.]]), tensor([5., 2., 3., 4., 5., 6., 7.]))"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Changing z changes x\n",
"z[:, 0] = 5\n",
"z, x"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -1489,13 +1561,13 @@
{
"data": {
"text/plain": [
"tensor([[1., 2., 3., 4., 5., 6., 7.],\n",
" [1., 2., 3., 4., 5., 6., 7.],\n",
" [1., 2., 3., 4., 5., 6., 7.],\n",
" [1., 2., 3., 4., 5., 6., 7.]])"
"tensor([[5., 2., 3., 4., 5., 6., 7.],\n",
" [5., 2., 3., 4., 5., 6., 7.],\n",
" [5., 2., 3., 4., 5., 6., 7.],\n",
" [5., 2., 3., 4., 5., 6., 7.]])"
]
},
"execution_count": 123,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
@@ -1562,6 +1634,139 @@
"x_unsqueezed, x_unsqueezed.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## TK - Indexing (selecting data from tensors)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[[0, 1, 2],\n",
" [3, 4, 5],\n",
" [6, 7, 8]]])"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import torch\n",
"tensor = torch.arange(0, 9, 1).view(1, 3, 3)\n",
"tensor"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0, 1, 2],\n",
" [3, 4, 5],\n",
" [6, 7, 8]])"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tensor[0]"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0, 1, 2]])"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tensor[:, 0]"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[1, 4, 7]])"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tensor[:, :, 1]"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([4])"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tensor[:, 1, 1]"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[0, 3, 6]])"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tensor[:, :, 0]"
]
},
{
"cell_type": "markdown",
"metadata": {
+61
View File
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 01. PyTorch Workflow Fundamentals\n",
"\n",
"You: have some data + want it modelled.\n",
"\n",
"Let's do that with PyTorch.\n",
"\n",
"How about we start with a straight line?\n",
"\n",
"And we see if we can build a model with PyTorch to predict that straight line.\n",
"\n",
"## TK - What we're going to cover\n",
"\n",
"1. Data\n",
"2. Load data\n",
"3. Build model\n",
"4. Fitting model to data (training)\n",
"5. Making predictions (inference)\n",
"6. Saving and loading model\n",
"7. Putting it all together\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "3fbe1355223f7b2ffc113ba3ade6a2b520cadace5d5ec3e828c83ce02eb221bf"
},
"kernelspec": {
"display_name": "Python 3.9.7 64-bit (conda)",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
+235
View File
@@ -0,0 +1,235 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 02. Neural Network Classification with PyTorch\n",
"\n",
"## TK - What we're going to cover\n",
"\n",
"## TK - How you can use this notebook\n",
"\n",
"## TK - Architecture of a classification network"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## TK - Make data"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from sklearn.datasets import make_moons\n",
"\n",
"# Make 1000 samples \n",
"n_samples = 1000\n",
"\n",
"# Create circles\n",
"X, y = make_moons(n_samples,\n",
" noise=0.07,\n",
" random_state=42) # keep random state so we get the same values"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>X1</th>\n",
" <th>X2</th>\n",
" <th>label</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>-0.033411</td>\n",
" <td>0.421391</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.998827</td>\n",
" <td>-0.442890</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.889592</td>\n",
" <td>-0.327843</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.341958</td>\n",
" <td>-0.417690</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>-0.838531</td>\n",
" <td>0.532375</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" X1 X2 label\n",
"0 -0.033411 0.421391 1\n",
"1 0.998827 -0.442890 1\n",
"2 0.889592 -0.327843 1\n",
"3 0.341958 -0.417690 1\n",
"4 -0.838531 0.532375 0"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get dataframe of moons\n",
"import pandas as pd\n",
"moons = pd.DataFrame({\"X1\": X[:, 0],\n",
" \"X2\": X[:, 1],\n",
" \"label\": y\n",
"})\n",
"moons.head()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1 500\n",
"0 500\n",
"Name: label, dtype: int64"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Check different labels\n",
"moons.label.value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.collections.PathCollection at 0x7f53bb9db580>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD4CAYAAADhNOGaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACFdUlEQVR4nO2ddXgUV9fAf3dmNUIUggZ3dysFStGWQp0adUpbal/d37p7+1bfGvXSQoHi7u7uGkiAuKzO/f7YEJLsbrJJNiEh83seHnZn7r1zdrI7595zjwgpJTo6Ojo61RflfAugo6Ojo3N+0RWBjo6OTjV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fkfe2zlDf5rBAaXTzFSQuXO33vC3xtO/4B1UJKBraFYRAOR2d8iRYXkM3FHNeAvf7OTcDj6LQKYRiMGCpGZ33Pv7qoax/6DWvdprdQY3WTT0RwT5m/RKJ9LkdE3wUoxHNfc78VFweIc3hZOXYJxEmY4mUVUyPDnmvy1JSUjEbOfTDlCLb2E6c8nm89qDenJy7ougoZqOR+lcNLrV8OjoVQdV1Aq+GGGuEMXDm196++1KyaOR4ktf7XkwJCTE9O/g8F1Q0WbrNZk0r2YpFStZNeDmvmI1QFMJL4DYLIEwmMKho9tKvlKTLXWSCPgwKxsgLine truncated
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Visualize with a plot\n",
"import matplotlib.pyplot as plt\n",
"plt.scatter(X[:, 0], X[:, 1], c=y, cmap=plt.cm.RdYlBu)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"TK - why show data like this? This is a toy problem but it represents the major key of classification, you have some kind of data represented as numerical values and you'd like to build a model that's able to classify (separate red from blue) it."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# UPTOHERE - building a model "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "3fbe1355223f7b2ffc113ba3ade6a2b520cadace5d5ec3e828c83ce02eb221bf"
},
"kernelspec": {
"display_name": "Python 3.9.7 64-bit (conda)",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
+25
View File
@@ -8,6 +8,31 @@ Stay tuned to here for updates. Course materials will be actively worked on for
Launch early 2022.
## Outline
**Note:** This is rough and subject to change.
0. PyTorch fundamentals - ML is all about representing data as numbers (tensors) and manipulating those tensors so this module will cover PyTorch tensors.
1. PyTorch workflow - You'll use different techniques for different problem types but the workflow remains much the same:
```
data -> build model -> fit model to data (training) -> evaluate model and make predictions (inference) -> save & load model
```
* Module 1 will showcase an end-to-end PyTorch workflow that can be leveraged for other problems.
2. PyTorch classification - Let's take the workflow we learned in module 1 and apply it to a common machine learning problem type: classification (deciding whether something is one thing or another).
3. PyTorch computer vision - We'll get even more specific now and see how PyTorch can be used for computer vision problems though still using the same workflow from 1 & 2.
4. Going modular - PyTorch is designed to be modular, let's turn what we've created into a series of Python scripts (this is how you'll often find PyTorch code in the wild). For example:
```
code/
model.py
training.py
eval.py
```
5. ???
Still tossing up ideas for the last one. Possibly a two scaled up projects to emphasize everything in 2, 3, 4.
Some ideas: transfer learning + replicate a modern paper with pure PyTorch?
## Log
Almost daily updates of what's happening.