2910 lines
168 KiB
Plaintext
2910 lines
168 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"<a href=\"https://colab.research.google.com/github/mrdbourke/pytorch-deep-learning/blob/main/extras/pytorch_2_intro.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
|
||
"\n",
|
||
"[View Source Code](https://github.com/mrdbourke/pytorch-deep-learning/blob/main/extras/pytorch_2_intro.ipynb)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"# A Quick PyTorch 2.0 Tutorial"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Notebook last updated: 2023-04-14 15:24:37.007274\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import datetime\n",
|
||
"print(f\"Notebook last updated: {datetime.datetime.now()}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"\n",
|
||
"## 30-second intro\n",
|
||
"\n",
|
||
"PyTorch 2.0 is out!\n",
|
||
"\n",
|
||
"With the main improvement being speed.\n",
|
||
"\n",
|
||
"This comes via a single backwards-compatible line.\n",
|
||
"\n",
|
||
"```python\n",
|
||
"torch.compile()\n",
|
||
"```\n",
|
||
"\n",
|
||
"In other words, after you create your model, you can pass it to `torch.compile()` and in turn expect speedups in training and inference on newer GPUs (e.g. NVIDIA RTX 40 series, A100, H100, the newer the GPU the more noticeable the speedups).\n",
|
||
"\n",
|
||
"> **Note:** There are plenty more upgrades within PyTorch 2.0 than just `torch.compile()` but since it's the main one, it's what we're going to focus on. For a full list of changes, see the [PyTorch 2.0 release notes](https://pytorch.org/blog/pytorch-2.0-release/).\n",
|
||
"\n",
|
||
"### Will my old PyTorch code still work?\n",
|
||
"\n",
|
||
"Yes, PyTorch 2.0 is backwards-compatible. The changes are mostly additive (new features).\n",
|
||
"\n",
|
||
"That means if you already know PyTorch, such as via the [learnpytorch.io](https://learnpytorch.io) course, you can start using PyTorch 2.0 straight away. And your old PyTorch code will still work."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Quick code examples"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### Before PyTorch 2.0"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"import torch\n",
|
||
"import torchvision\n",
|
||
"\n",
|
||
"model = torchvision.models.resnet50() # note: this could be any model\n",
|
||
"\n",
|
||
"### Train model ###\n",
|
||
"\n",
|
||
"### Test model ###"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### After PyTorch 2.0"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"import torch\n",
|
||
"import torchvision\n",
|
||
"\n",
|
||
"model = torchvision.models.resnet50() # note: this could be any model\n",
|
||
"compiled_model = torch.compile(model) # <- magic happens!\n",
|
||
"\n",
|
||
"### Train model ### <- faster!\n",
|
||
"\n",
|
||
"### Test model ### <- faster!"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Speedups\n",
|
||
"\n",
|
||
"Ok so the focus of PyTorch 2.0 is speed, how much faster is it actually?\n",
|
||
"\n",
|
||
"The PyTorch team ran tests across 163 open-source models from [Hugging Face Transformers](https://huggingface.co/docs/transformers/index), [timm](https://github.com/huggingface/pytorch-image-models) (PyTorch Image Models) and [TorchBench](https://github.com/pytorch/benchmark) (a curated set of popular code bases from across GitHub).\n",
|
||
"\n",
|
||
"This is important because unless PyTorch 2.0 is faster on models people actually use, it’s not faster.\n",
|
||
"\n",
|
||
"Using a mixture of AMP (automatic mixed precision or float16) training and float32 precision (higher precision requires more compute) the PyTorch team found that `torch.compile()` provides an average speedup of 43% in training on a NVIDIA A100 GPU.\n",
|
||
"\n",
|
||
"Or 38% on timm, 76% on TorchBench and 52% on Hugging Face Transformers.\n",
|
||
"\n",
|
||
"<img src=\"https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/extras-pytorch-2-speedups.png\" alt=\"speedups for PyTorch 2.0 across various model resources\" width=650/>\n",
|
||
"\n",
|
||
"*PyTorch 2.0 speedups across various models from different locations. *Source:* [PyTorch 2.0 announcement post](https://pytorch.org/get-started/pytorch-2.0/).*"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 3-minute overview\n",
|
||
"\n",
|
||
"> **Note:** The following is adapted from [*A Quick Introduction to PyTorch 2.0*](https://www.mrdbourke.com/pytorch-2/) on mrdbourke.com, there's also an accompanying [video explainer on YouTube](https://youtu.be/WqLKfta5Ijw).\n",
|
||
"\n",
|
||
"What's happening behind the scenes of `torch.compile()`?\n",
|
||
"\n",
|
||
"`torch.compile()` is designed to \"just work\" but there are a few technologies behind it:\n",
|
||
"* TorchDynamo\n",
|
||
"* AOTAutograd\n",
|
||
"* PrimTorch\n",
|
||
"* TorchInductor\n",
|
||
"\n",
|
||
"The [PyTorch 2.0 getting started notes](https://pytorch.org/get-started/pytorch-2.0/) explain these in more detail but from a high level the two main improvements `torch.compile()` offers are:\n",
|
||
"* Fusion (or operator fusion)\n",
|
||
"* Graph capture (or graph tracing)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### Fusion\n",
|
||
"\n",
|
||
"Fusion, also known as **operator fusion** is one of the best ways to make deep learning models go brrrrrr (brrrrrr is the sound your GPUs fan make when your models are training).\n",
|
||
"\n",
|
||
"Operator fusion condenses (like Dragon Ball Z) many operations into one (or many to less).\n",
|
||
"\n",
|
||
"Why?\n",
|
||
"\n",
|
||
"Modern GPUs have so much compute power they are often not compute limited, as in, the main bottleneck to training models is how fast you can get data from your CPU to your GPU.\n",
|
||
"This is known as bandwidth or memory bandwidth.\n",
|
||
"\n",
|
||
"You want to reduce your bandwidth costs as much as possible.\n",
|
||
"\n",
|
||
"And feed the data hungry GPUs with as much data as possible.\n",
|
||
"\n",
|
||
"<img src=\"https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/extras-memory-bandwidth-output-small.gif\" alt=\"example of memory bandwidth costs transferring data on and off the GPU\" width=950/>\n",
|
||
"\n",
|
||
"So instead of performing an operation on a piece of data and then saving the result to memory (increased bandwidth costs), you chain together as many operations as possible via fusion.\n",
|
||
"\n",
|
||
"A rough analogy would be using a blender to make a smoothie.\n",
|
||
"\n",
|
||
"Most blenders are good at blending things (like GPUs are good at performing matrix multiplications).\n",
|
||
"\n",
|
||
"Using a blender **without operator fusion** would be like adding each ingredient one by one and blending each time a new ingredient is added.\n",
|
||
"Not only is this insane, it increases your bandwidth cost.\n",
|
||
"\n",
|
||
"The actual blending is fast each time (like GPU computations generally are) but you lose a bunch of time adding each ingredient one by one.\n",
|
||
"\n",
|
||
"Using a blender **with operator fusion** is akin to using a blender by adding all the ingredients at the start (operator fusion) and then performing the blend once.\n",
|
||
"\n",
|
||
"You lose a little time adding at the start but you gain all of the lost memory bandwidth time back."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### Graph capture\n",
|
||
"\n",
|
||
"Graph capture I’m less confident explaining.\n",
|
||
"\n",
|
||
"But the way I think about it is that graph capture or graph tracing is:\n",
|
||
"\n",
|
||
"* Going through a series of operations that need to happen, such as the operations in a neural network.\n",
|
||
"* And capturing or tracing what needs to happen ahead of time.\n",
|
||
"\n",
|
||
"Computing **without graph capture** is like going to a new area and following GPS directions turn by turn.\n",
|
||
"\n",
|
||
"As a good human driver, you can follow the turns quite easily but you still have to think about each turn you take.\n",
|
||
"\n",
|
||
"This is the equivalent to PyTorch having to look up what each operation does as it does it.\n",
|
||
"\n",
|
||
"As in, to perform an addition, it has to look up what an addition does before it can perform it.\n",
|
||
"\n",
|
||
"It does this quickly but there’s still non-zero overhead.\n",
|
||
"\n",
|
||
"<img src=\"https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/extras-graph-capture.gif\" alt=\"Graph capture\" width=\"950\"/>\n",
|
||
"\n",
|
||
"*Example of graph capture, mapping out the steps in a neural network and then capturing every operation that needs to happen ahead of time.*\n",
|
||
"\n",
|
||
"Computing **with graph capture** is like driving through your own neighbourhood.\n",
|
||
"\n",
|
||
"You barely think about what turns to make.\n",
|
||
"\n",
|
||
"Sometimes you get out of the car and realise you can’t remember the last 5 minutes of the drive.\n",
|
||
"\n",
|
||
"Your brain was functioning on autopilot, minimal overhead.\n",
|
||
"\n",
|
||
"However, it took you some time upfront to remember how to drive to your house.\n",
|
||
"\n",
|
||
"This is a caveat of graph capture, it takes a little time upfront to memorize the operations that need to happen but subsequent computations should be faster.\n",
|
||
"\n",
|
||
"Of course, this is a quick high-level overview of what’s happening behind the scenes of torch.compile()but it's how I understand it.\n",
|
||
"\n",
|
||
"For more on fusion and graph tracing, I’d recommend Horace He’s [*Making Deep Learning Go Brrrr From First Principles*](https://horace.io/brrr_intro.html) blog post."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Things to note\n",
|
||
"\n",
|
||
"Since PyTorch 2.0 was just released, there are a few limitations with some of the features.\n",
|
||
"\n",
|
||
"One of the main ones being with exporting models.\n",
|
||
"\n",
|
||
"<img src=\"https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/extras-pytorch-2-limitations.png\" alt=\"PyTorch 2 limitations\" width=650/>\n",
|
||
"\n",
|
||
"*There are a few caveats when using the PyTorch 2.0 features, such as not being about to export to mobile devices when using the `torch.compile()` default options. However, there are work arounds to this and improved exporting is on the PyTorch 2.x roadmap. *Source:* [PyTorch 2.0 announcement post](https://pytorch.org/get-started/pytorch-2.0/).*\n",
|
||
"\n",
|
||
"However, these will likely be fixed in future releases.\n",
|
||
"\n",
|
||
"Another main limitation is that because the features of PyTorch 2.0 are designed for newer hardware, old GPUs and desktop-class GPUs (e.g. NVIDIA RTX 30 series) will likely see less speedups than newer hardware."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## What we're going to cover\n",
|
||
"\n",
|
||
"Since many of the upgrades in PyTorch 2.0 are speed focused and happen behind the scenes (e.g. PyTorch takes care of them for you), in this notebook we're going to run a comparative speed test.\n",
|
||
"\n",
|
||
"Namely we'll make two of the same models, one using the default PyTorch setup and the other using the new `torch.compile()` setup and we'll train them on the same dataset.\n",
|
||
"\n",
|
||
"1. Model 1 - no `torch.compile()`.\n",
|
||
"2. Model 2 - `torch.compile()`.\n",
|
||
"\n",
|
||
"We'll then compare the training/testing times of both models for single run and multiple runs.\n",
|
||
"\n",
|
||
"| **Experiment** | **Model** | **Data** | **Epochs** | **Batch size** | **Image size** | **`torch.compile()`** | \n",
|
||
"|----- |-----| -----| -----| -----| -----| -----|\n",
|
||
"| 1 (single run) | [ResNet50](https://pytorch.org/vision/master/models/generated/torchvision.models.resnet50.html) | [CIFAR10](https://pytorch.org/vision/stable/generated/torchvision.datasets.CIFAR10.html#torchvision.datasets.CIFAR10) | 5 | 128 | 224 | No |\n",
|
||
"| 2 (single run) | ResNet50 | CIFAR10 | 5 | 128 | 224 | Yes |\n",
|
||
"| 3 (multi-run) | ResNet50 | CIFAR10 | 3x5 | 128 | 224 | No |\n",
|
||
"| 4 (multi-run) | ResNet50 | CIFAR10 | 3x5 | 128 | 224 | Yes |\n",
|
||
"\n",
|
||
"We've chosen ResNet50 and CIFAR10 here for ease of access or use, however, you could substitute any model/dataset you like.\n",
|
||
"\n",
|
||
"The biggest speedups I've noticed with PyTorch 2.0 are when the GPU computes on as much data as possible (e.g. larger batch size/image size/data size/model size). \n",
|
||
"\n",
|
||
"> **Note:** Depending on the size of your GPU, you may have to lower the batch size (or image size) to fit the model on your GPU. For example, if you're using a GPU with 8GB of memory or less, you may have to lower the batch size to 64 or 32."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 0. Getting setup\n",
|
||
"\n",
|
||
"To get setup we'll first check for PyTorch 2.x+ and install it if it's not available. \n",
|
||
"\n",
|
||
"You can see how to install PyTorch 2.x on your own system in the [PyTorch documentation](https://pytorch.org/get-started/locally/).\n",
|
||
"\n",
|
||
"> **Note:** If you're running on Google Colab, you'll need to setup a GPU: runtime -> change runtime type -> hardware accelerator. The best speedups are on newer NVIDIA/AMD GPUs (this is because PyTorch 2.0 leverages newer GPU hardware) such as the NVIDIA A100 and above. This tutorial focuses on NVIDIA GPUs."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 4,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Current PyTorch version: 2.0.0+cu118 (should be 2.x+)\n",
|
||
"[INFO] PyTorch 2.x installed, you'll be able to use the new features.\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import torch\n",
|
||
"\n",
|
||
"# Check PyTorch version\n",
|
||
"pt_version = torch.__version__\n",
|
||
"print(f\"[INFO] Current PyTorch version: {pt_version} (should be 2.x+)\")\n",
|
||
"\n",
|
||
"# Install PyTorch 2.0 if necessary\n",
|
||
"if pt_version.split(\".\")[0] == \"1\": # Check if PyTorch version begins with 1 \n",
|
||
" !pip3 install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118\n",
|
||
" print(\"[INFO] PyTorch 2.x installed, if you're on Google Colab, you may need to restart your runtime.\\\n",
|
||
" Though as of April 2023, Google Colab comes with PyTorch 2.0 pre-installed.\")\n",
|
||
" import torch\n",
|
||
" pt_version = torch.__version__\n",
|
||
" print(f\"[INFO] Current PyTorch version: {pt_version} (should be 2.x+)\")\n",
|
||
"else:\n",
|
||
" print(\"[INFO] PyTorch 2.x installed, you'll be able to use the new features.\")"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Wonderful!\n",
|
||
"\n",
|
||
"Now PyTorch 2.x is installed, let's try out the new features!"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 1. Get GPU info\n",
|
||
"\n",
|
||
"Time to get GPU info.\n",
|
||
"\n",
|
||
"Why?\n",
|
||
"\n",
|
||
"Many of the speedups PyTorch 2.0 offers are best experienced on newer NVIDIA GPUs (we're focused on NVIDIA GPUs for now).\n",
|
||
"\n",
|
||
"This is because PyTorch 2.0 takes advantage of the new hardware on newer GPUs.\n",
|
||
"\n",
|
||
"How do you tell what's a newer GPU?\n",
|
||
"\n",
|
||
"Generally, a *newer* GPU will have a compute capability score of 8.0 or higher.\n",
|
||
"\n",
|
||
"You can see a list of [NVIDIA GPU compute capability scores](https://developer.nvidia.com/cuda-gpus) on NVIDIA's developer page.\n",
|
||
"\n",
|
||
"Here are some scores of NVIDIA GPUs released in 2020 or later:\n",
|
||
"\n",
|
||
"| **NVIDIA GPU** | **Compute capability score** | **GPU Type** | **Release year** | **Architecture** |\n",
|
||
"|----- |-----| -----| -----| -----| \n",
|
||
"| RTX 4090 | 8.9 | Desktop-class | 2022 | [Ada Lovelace](https://www.nvidia.com/en-au/geforce/ada-lovelace-architecture/) |\n",
|
||
"| RTX 4080 | 8.9 | Desktop-class | 2022 | Ada Lovelace |\n",
|
||
"| RTX 4070 Ti | 8.9 | Desktop-class | 2022 | Ada Lovelace |\n",
|
||
"| RTX 3090 | 8.6 | Desktop-class | 2020 | [Ampere](https://en.wikipedia.org/wiki/Ampere_(microarchitecture)) |\n",
|
||
"| RTX 3080 | 8.6 | Desktop-class | 2020 | Ampere| \n",
|
||
"| RTX 3070 | 8.6 | Desktop-class | 2020 | Ampere | \n",
|
||
"| RTX 3060 Ti | 8.6 | Desktop-class | 2020 | Ampere | \n",
|
||
"| H100 | 9.0 | Datacenter-class | 2022 | [Hopper](https://developer.nvidia.com/blog/nvidia-hopper-architecture-in-depth/) | \n",
|
||
"| A100 | 8.0 | Datacenter-class | 2020 | Ampere |\n",
|
||
"| A10 | 8.6 | Datacenter-class | 2021 | Ampere |\n",
|
||
"\n",
|
||
"GPUs with a compute capability score of 8.0 or above are likely to see the biggest speedups.\n",
|
||
"\n",
|
||
"And GPUs which are datacenter-class (e.g. A100, A10, H100) are likely to see more significant speedups than desktop-class GPUs (e.g. RTX 3090, RTX 3080, RTX 3070, RTX 3060 Ti).\n",
|
||
"\n",
|
||
"We can check the compute capability score of our GPU using [`torch.cuda.get_device_capability()`](https://pytorch.org/docs/stable/generated/torch.cuda.get_device_capability.html).\n",
|
||
"\n",
|
||
"This will output a tuple of `(major, minor)` compute capability scores, for example, `(8, 0)` for the A100.\n",
|
||
"\n",
|
||
"We'll also get some other details about our GPU such as the name and other info using [`nvidia-smi`](https://developer.nvidia.com/nvidia-system-management-interface). \n",
|
||
"\n",
|
||
"> **Resource:** For an in-depth comparison of many different NVIDIA GPUs and their speeds, costs and tradeoffs, I'd recommend reading Tim Dettmers' [*Which GPU for deep learning?*](https://timdettmers.com/2023/01/30/which-gpu-for-deep-learning/) blog post."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 5,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"GPU name: NVIDIA_TITAN_RTX\n",
|
||
"GPU capability score: (7, 5)\n",
|
||
"GPU score lower than (8, 0), PyTorch 2.x speedup features will be limited (PyTorch 2.x speedups happen most on newer GPUs).\n",
|
||
"GPU information:\n",
|
||
"Fri Apr 14 15:24:38 2023 \n",
|
||
"+-----------------------------------------------------------------------------+\n",
|
||
"| NVIDIA-SMI 525.89.02 Driver Version: 525.89.02 CUDA Version: 12.0 |\n",
|
||
"|-------------------------------+----------------------+----------------------+\n",
|
||
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
||
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
|
||
"| | | MIG M. |\n",
|
||
"|===============================+======================+======================|\n",
|
||
"| 0 NVIDIA TITAN RTX Off | 00000000:01:00.0 Off | N/A |\n",
|
||
"| 40% 50C P8 9W / 280W | 260MiB / 24576MiB | 0% Default |\n",
|
||
"| | | N/A |\n",
|
||
"+-------------------------------+----------------------+----------------------+\n",
|
||
" \n",
|
||
"+-----------------------------------------------------------------------------+\n",
|
||
"| Processes: |\n",
|
||
"| GPU GI CI PID Type Process name GPU Memory |\n",
|
||
"| ID ID Usage |\n",
|
||
"|=============================================================================|\n",
|
||
"| 0 N/A N/A 1020 G /usr/lib/xorg/Xorg 53MiB |\n",
|
||
"| 0 N/A N/A 1415245 G /usr/lib/xorg/Xorg 162MiB |\n",
|
||
"| 0 N/A N/A 1415374 G /usr/bin/gnome-shell 8MiB |\n",
|
||
"+-----------------------------------------------------------------------------+\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Make sure we're using a NVIDIA GPU\n",
|
||
"if torch.cuda.is_available():\n",
|
||
" gpu_info = !nvidia-smi\n",
|
||
" gpu_info = '\\n'.join(gpu_info)\n",
|
||
" if gpu_info.find(\"failed\") >= 0:\n",
|
||
" print(\"Not connected to a GPU, to leverage the best of PyTorch 2.0, you should connect to a GPU.\")\n",
|
||
"\n",
|
||
" # Get GPU name\n",
|
||
" gpu_name = !nvidia-smi --query-gpu=gpu_name --format=csv\n",
|
||
" gpu_name = gpu_name[1]\n",
|
||
" GPU_NAME = gpu_name.replace(\" \", \"_\") # remove underscores for easier saving\n",
|
||
" print(f'GPU name: {GPU_NAME}')\n",
|
||
"\n",
|
||
" # Get GPU capability score\n",
|
||
" GPU_SCORE = torch.cuda.get_device_capability()\n",
|
||
" print(f\"GPU capability score: {GPU_SCORE}\")\n",
|
||
" if GPU_SCORE >= (8, 0):\n",
|
||
" print(f\"GPU score higher than or equal to (8, 0), PyTorch 2.x speedup features available.\")\n",
|
||
" else:\n",
|
||
" print(f\"GPU score lower than (8, 0), PyTorch 2.x speedup features will be limited (PyTorch 2.x speedups happen most on newer GPUs).\")\n",
|
||
" \n",
|
||
" # Print GPU info\n",
|
||
" print(f\"GPU information:\\n{gpu_info}\")\n",
|
||
"\n",
|
||
"else:\n",
|
||
" print(\"PyTorch couldn't find a GPU, to leverage the best of PyTorch 2.0, you should connect to a GPU.\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 1.1 Globally set devices\n",
|
||
"\n",
|
||
"One of my favourite new features in PyTorch 2.x is being able to set the [default device type](https://pytorch.org/tutorials/recipes/recipes/changing_default_device.html ) via:\n",
|
||
"* Context manager\n",
|
||
"* Globally\n",
|
||
"\n",
|
||
"Previously, you could only set the default device type via:\n",
|
||
"* `tensor.to(device)`\n",
|
||
"\n",
|
||
"Let's see these two new device settings in action."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 6,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Layer weights are on device: cuda:0\n",
|
||
"Layer creating data on device: cuda:0\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import torch\n",
|
||
"\n",
|
||
"# Set the device\n",
|
||
"device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
||
"\n",
|
||
"# Set the device with context manager (requires PyTorch 2.x+)\n",
|
||
"with torch.device(device):\n",
|
||
" # All tensors created in this block will be on device\n",
|
||
" layer = torch.nn.Linear(20, 30)\n",
|
||
" print(f\"Layer weights are on device: {layer.weight.device}\")\n",
|
||
" print(f\"Layer creating data on device: {layer(torch.randn(128, 20)).device}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Now how about setting the global device?\n",
|
||
"\n",
|
||
"This will mean that any tensors created without an explicit device will be created on the device you set by default."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 7,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Layer weights are on device: cuda:0\n",
|
||
"Layer creating data on device: cuda:0\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import torch\n",
|
||
"\n",
|
||
"# Set the device\n",
|
||
"device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
||
"\n",
|
||
"# Set the device globally\n",
|
||
"torch.set_default_device(device)\n",
|
||
"\n",
|
||
"# All tensors created will be on the global device by default\n",
|
||
"layer = torch.nn.Linear(20, 30)\n",
|
||
"print(f\"Layer weights are on device: {layer.weight.device}\")\n",
|
||
"print(f\"Layer creating data on device: {layer(torch.randn(128, 20)).device}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"And now back to CPU."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 8,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Layer weights are on device: cpu\n",
|
||
"Layer creating data on device: cpu\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import torch \n",
|
||
"\n",
|
||
"# Set the device globally\n",
|
||
"torch.set_default_device(\"cpu\")\n",
|
||
"\n",
|
||
"# All tensors created will be on \"cpu\"\n",
|
||
"layer = torch.nn.Linear(20, 30)\n",
|
||
"print(f\"Layer weights are on device: {layer.weight.device}\")\n",
|
||
"print(f\"Layer creating data on device: {layer(torch.randn(128, 20)).device}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 2. Setting up the experiments \n",
|
||
"\n",
|
||
"Okay, time to measure speed!\n",
|
||
"\n",
|
||
"To keep things simple, as we discussed we're going to run a series of four experiments, all with:\n",
|
||
"\n",
|
||
"* **Model:** ResNet50 (from [TorchVision](https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html))\n",
|
||
"* **Data:** CIFAR10 (from [TorchVision](https://pytorch.org/vision/main/generated/torchvision.datasets.CIFAR10.html))\n",
|
||
"* **Epochs:** 5 (single run) and 3x5 (multiple runs)\n",
|
||
"* **Batch size:** 128\n",
|
||
"* **Image size:** 224\n",
|
||
"\n",
|
||
"Each experiment will be run with and without `torch.compile()`.\n",
|
||
"\n",
|
||
"Why the single and multiple runs?\n",
|
||
"\n",
|
||
"Because we can measure speedups via a single run, however, we'll also want to run the tests multiple times to get an average (just to make sure the results from a single run weren't a fluke or something went wrong). \n",
|
||
"\n",
|
||
"> **Note:** Depending on the amount of memory your GPU has, you may have to lower the batch size or the image size. This tutorial is focused on using an NVIDIA A100 GPU with 40GB of memory, the amount of memory on this GPU means it can handle a larger batch size. As of April 2023, NVIDIA A100 GPUs are available via Google Colab Pro. \n",
|
||
"\n",
|
||
"Let's start by importing `torch` and `torchvision` and setting the target device."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 9,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"PyTorch version: 2.0.0+cu118\n",
|
||
"TorchVision version: 0.15.1+cu118\n",
|
||
"Using device: cuda\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"import torch\n",
|
||
"import torchvision\n",
|
||
"\n",
|
||
"print(f\"PyTorch version: {torch.__version__}\")\n",
|
||
"print(f\"TorchVision version: {torchvision.__version__}\")\n",
|
||
"\n",
|
||
"# Set the target device\n",
|
||
"device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
||
"\n",
|
||
"print(f\"Using device: {device}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.1 Create model and transforms\n",
|
||
"\n",
|
||
"Let's now create our model and transforms.\n",
|
||
"\n",
|
||
"We'll use the same setup to create the model and transforms we covered in [06. PyTorch Transfer Learning section 2.2](https://www.learnpytorch.io/06_pytorch_transfer_learning/).\n",
|
||
"\n",
|
||
"In essence, we'll create the model and transforms for the model using the [`torchvision.models`](https://pytorch.org/vision/stable/models.html) API.\n",
|
||
"\n",
|
||
"We can get the weights and transforms for ResNet50 using the following:\n",
|
||
"* `model_weights = torchvision.models.ResNet50_Weights.IMAGENET1K_V2` (this requires `torchvision` 0.14 or later).\n",
|
||
"* `transforms = model_weights.transforms()` (once we have the weights, we can get the appropriate transforms for the model).\n",
|
||
"\n",
|
||
"> **Note:** We'll count the model's parameters to see how big of a model we're working with. The more parameters in a model, the larger GPU memory you'll need to train it. However, the more parameters your model has, the more GPU memory it uses, the larger *relative* speedup you'll often see. Meaning, a larger model may take longer to train in total, however, on a relative basis because it's using more GPU power, it could be faster than a smaller model. As in, a model with 10M parameters may take only 5x longer to train than a model with 1M parameters (10x the size but only 5x the training time). "
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 10,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Total parameters of model: 25557032 (the more parameters, the more GPU memory the model will use, the more *relative* of a speedup you'll get)\n",
|
||
"Model transforms:\n",
|
||
"ImageClassification(\n",
|
||
" crop_size=[224]\n",
|
||
" resize_size=[232]\n",
|
||
" mean=[0.485, 0.456, 0.406]\n",
|
||
" std=[0.229, 0.224, 0.225]\n",
|
||
" interpolation=InterpolationMode.BILINEAR\n",
|
||
")\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create model weights and transforms\n",
|
||
"model_weights = torchvision.models.ResNet50_Weights.IMAGENET1K_V2 # <- use the latest weights (could also use .DEFAULT)\n",
|
||
"transforms = model_weights.transforms()\n",
|
||
"\n",
|
||
"# Setup model\n",
|
||
"model = torchvision.models.resnet50(weights=model_weights)\n",
|
||
"\n",
|
||
"# Count the number of parameters in the model \n",
|
||
"total_params = sum(\n",
|
||
" param.numel() for param in model.parameters() # <- all params\n",
|
||
"\t# param.numel() for param in model.parameters() if param.requires_grad # <- only trainable params\n",
|
||
")\n",
|
||
"\n",
|
||
"print(f\"Total parameters of model: {total_params} (the more parameters, the more GPU memory the model will use, the more *relative* of a speedup you'll get)\")\n",
|
||
"print(f\"Model transforms:\\n{transforms}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Now let's turn the above code into a function so we can replicate it later, we'll also adjust the last layer's (`model.fc`) output features to match the number of classes in CIFAR10 (10)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 11,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"def create_model(num_classes=10):\n",
|
||
" \"\"\"\n",
|
||
" Creates a ResNet50 model with the latest weights and transforms via torchvision.\n",
|
||
" \"\"\"\n",
|
||
" model_weights = torchvision.models.ResNet50_Weights.IMAGENET1K_V2\n",
|
||
" transforms = model_weights.transforms()\n",
|
||
" model = torchvision.models.resnet50(weights=model_weights)\n",
|
||
" \n",
|
||
" # Adjust the number of output features in model to match the number of classes in the dataset\n",
|
||
" model.fc = torch.nn.Linear(in_features=2048, \n",
|
||
" out_features=num_classes)\n",
|
||
" return model, transforms\n",
|
||
"\n",
|
||
"model, transforms = create_model()"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.2 Speedups are most noticeable when a large portion of the GPU is being used\n",
|
||
"\n",
|
||
"Since modern GPUs are so fast at performing operations, you will often notice the majority of *relative* speedups when as much data as possible is on the GPU.\n",
|
||
"\n",
|
||
"This can be achieved by:\n",
|
||
"* **Increasing the batch size** - More samples per batch means more samples on the GPU, for example, using a batch size of 256 instead of 32.\n",
|
||
"* **Increasing data size** - For example, using larger image size, 224x224 instead of 32x32. A larger data size means that more tensor operations will be happening on the GPU.\n",
|
||
"* **Increasing model size** - For example, using a larger model such as ResNet101 instead of ResNet50. A larger model means that more tensor operations will be happening on the GPU.\n",
|
||
"* **Decreasing data transfer** - For example, setting up all your tensors to be on GPU memory, this minimizes the amount of data transfer between the CPU and GPU.\n",
|
||
"\n",
|
||
"All of these result in *more* data being on the GPU.\n",
|
||
"\n",
|
||
"<img src=\"https://raw.githubusercontent.com/mrdbourke/pytorch-deep-learning/main/images/extras-speedups-are-biggest-when-more-gpu-is-used.png\" width=950 alt=\"speedups are biggest when more of the GPU is used\"/>\n",
|
||
"\n",
|
||
"You may be thinking, \"but doesn't this mean that the GPU will be slower because it has to do more work?\"\n",
|
||
"\n",
|
||
"This is correct, operations may take longer when using *more* data on the GPU, however, they benefit from [parallelism](https://en.wikipedia.org/wiki/Parallel_computing) (many operations happening at once).\n",
|
||
"\n",
|
||
"This means that although *more* operations are happening, the GPU is performing as many of them as possible simultaneously.\n",
|
||
"\n",
|
||
"So while you may see speedups with smaller datasets, models, batch sizes and data sizes, however, you will tend to see the *biggest relative* speedups with increasing scale.\n",
|
||
"\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.3 Checking the memory limits of our GPU\n",
|
||
"\n",
|
||
"To take advantage of speedups at scale, let's check how much memory our GPU has.\n",
|
||
"\n",
|
||
"If your GPU has less memory, you may need to decrease the batch size or image size (less potential for speedups).\n",
|
||
"\n",
|
||
"We can check the memory available on our GPU using [`torch.cuda.mem_get_info()`](https://pytorch.org/docs/stable/generated/torch.cuda.mem_get_info.html#torch.cuda.mem_get_info).\n",
|
||
"\n",
|
||
"This will return a tuple of `(total_free_gpu_memory, total_gpu_memory)`.\n",
|
||
"\n",
|
||
"Where:\n",
|
||
"* `total_free_gpu_memory` is the amount of memory currently *not being used* on the GPU in bytes.\n",
|
||
"* `total_gpu_memory` is the total amount of memory available on the GPU in bytes. \n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 12,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Total free GPU memory: 24.187 GB\n",
|
||
"Total GPU memory: 25.386 GB\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Check available GPU memory and total GPU memory \n",
|
||
"total_free_gpu_memory, total_gpu_memory = torch.cuda.mem_get_info()\n",
|
||
"print(f\"Total free GPU memory: {round(total_free_gpu_memory * 1e-9, 3)} GB\")\n",
|
||
"print(f\"Total GPU memory: {round(total_gpu_memory * 1e-9, 3)} GB\")"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Wonderful!\n",
|
||
"\n",
|
||
"The takeaways here are:\n",
|
||
"1. The higher the memory available on your GPU, **the bigger your batch size can be, the bigger your model can be, the bigger your data samples can be**. \n",
|
||
"2. For speedups, you should always be trying to use **as much of the GPU(s) as possible**.\n",
|
||
"\n",
|
||
"Let's write some code to use a larger batch size if more GPU memory is available.\n",
|
||
"\n",
|
||
"> **Note:** The ideal batch size you use will depend on the specific GPU and dataset and model you're working with. The code below is specifically targeted for the A100 GPU available on Google Colab Pro. However, you may adjust it for your own GPU. As if you set the batch size too high, you may run into CUDA out of memory errors.\n",
|
||
"\n",
|
||
"If the total memory on the GPU available is **above 16GB**, let's use a batch size of 128 and an image size of 224 (both of these values can be increased on GPUs with more memory).\n",
|
||
"\n",
|
||
"If the total memory on the GPU available is **below 16GB**, let's use a batch size of 32 and an image size of 64 (both of these values can be altered on GPUs with less memory)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 13,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"GPU memory available is 24.187 GB, using batch size of 128 and image size 224\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Set batch size depending on amount of GPU memory\n",
|
||
"total_free_gpu_memory_gb = round(total_free_gpu_memory * 1e-9, 3)\n",
|
||
"if total_free_gpu_memory_gb >= 16:\n",
|
||
" BATCH_SIZE = 128 # Note: you could experiment with higher values here if you like.\n",
|
||
" IMAGE_SIZE = 224\n",
|
||
" print(f\"GPU memory available is {total_free_gpu_memory_gb} GB, using batch size of {BATCH_SIZE} and image size {IMAGE_SIZE}\")\n",
|
||
"else:\n",
|
||
" BATCH_SIZE = 32\n",
|
||
" IMAGE_SIZE = 128\n",
|
||
" print(f\"GPU memory available is {total_free_gpu_memory_gb} GB, using batch size of {BATCH_SIZE} and image size {IMAGE_SIZE}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Now let's adjust the `transforms` to use the respective `IMAGE_SIZE`."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 14,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Updated data transforms:\n",
|
||
"ImageClassification(\n",
|
||
" crop_size=224\n",
|
||
" resize_size=224\n",
|
||
" mean=[0.485, 0.456, 0.406]\n",
|
||
" std=[0.229, 0.224, 0.225]\n",
|
||
" interpolation=InterpolationMode.BILINEAR\n",
|
||
")\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"transforms.crop_size = IMAGE_SIZE\n",
|
||
"transforms.resize_size = IMAGE_SIZE \n",
|
||
"print(f\"Updated data transforms:\\n{transforms}\")"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.4 More potential speedups with TF32\n",
|
||
"\n",
|
||
"TF32 stands for TensorFloat-32, a data format which is a combination of 16-bit and 32-bit floating point numbers.\n",
|
||
"\n",
|
||
"You can read more about how it works on [NVIDIA's blog](https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/).\n",
|
||
"\n",
|
||
"The main thing you should know is that it allows you to **perform faster matrix multiplications** on GPUs with the Ampere architecture and above (a compute capability score of 8.0+).\n",
|
||
"\n",
|
||
"Although it's not specific to PyTorch 2.0, since we're talking about newer GPUs, it's worth mentioning.\n",
|
||
"\n",
|
||
"If you're using a GPU with a compute capability score of 8.0 or above, you can enable TF32 by setting [`torch.backends.cuda.matmul.allow_tf32 = True`](https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices) (this defaults to `False`).\n",
|
||
"\n",
|
||
"Let's write a check that sets it automatically for us based on our GPUs compute capability score.\n",
|
||
"\n",
|
||
"> **Note:** TensorFloat32 is disabled by default (set to `False`) in PyTorch versions 1.12 onwards. This is because it [may cause inconsistent results across different devices](https://dev-discuss.pytorch.org/t/pytorch-and-tensorfloat32/504). Although this issue is not noticed for all use cases, it's worth knowing. "
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 15,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Using GPU with score: (7, 5), TensorFloat32 (TF32) not available, to use it you need a GPU with score >= (8, 0)\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"if GPU_SCORE >= (8, 0):\n",
|
||
" print(f\"[INFO] Using GPU with score: {GPU_SCORE}, enabling TensorFloat32 (TF32) computing (faster on new GPUs)\")\n",
|
||
" torch.backends.cuda.matmul.allow_tf32 = True\n",
|
||
"else:\n",
|
||
" print(f\"[INFO] Using GPU with score: {GPU_SCORE}, TensorFloat32 (TF32) not available, to use it you need a GPU with score >= (8, 0)\")\n",
|
||
" torch.backends.cuda.matmul.allow_tf32 = False"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.5 Preparing datasets\n",
|
||
"\n",
|
||
"Computing setup done!\n",
|
||
"\n",
|
||
"Let's now create our datasets.\n",
|
||
"\n",
|
||
"To keep things simple, we'll use [CIFAR10](https://pytorch.org/vision/main/generated/torchvision.datasets.CIFAR10.html) since it's readily available in `torchvision`.\n",
|
||
"\n",
|
||
"Some info about CIFAR10 the [CIFAR10 website](https://www.cs.toronto.edu/~kriz/cifar.html):\n",
|
||
"\n",
|
||
"* CIFAR10 is a dataset of 60,000 32x32 color images in 10 classes, with 6,000 images per class.\n",
|
||
"* There are 50,000 training images and 10,000 test images.\n",
|
||
"* The dataset contains 10 classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck.\n",
|
||
"\n",
|
||
"Although the original dataset consists of 32x32 images, we'll use the `transforms` we created earlier to resize them to 224x224 (larger images provide more information and will take up more memory on the GPU)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 16,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Files already downloaded and verified\n",
|
||
"Files already downloaded and verified\n",
|
||
"[INFO] Train dataset length: 50000\n",
|
||
"[INFO] Test dataset length: 10000\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create train and test datasets\n",
|
||
"train_dataset = torchvision.datasets.CIFAR10(root='.', \n",
|
||
" train=True, \n",
|
||
" download=True, \n",
|
||
" transform=transforms)\n",
|
||
"\n",
|
||
"test_dataset = torchvision.datasets.CIFAR10(root='.', \n",
|
||
" train=False, # want the test split\n",
|
||
" download=True, \n",
|
||
" transform=transforms)\n",
|
||
"\n",
|
||
"# Get the lengths of the datasets\n",
|
||
"train_len = len(train_dataset)\n",
|
||
"test_len = len(test_dataset)\n",
|
||
"\n",
|
||
"print(f\"[INFO] Train dataset length: {train_len}\")\n",
|
||
"print(f\"[INFO] Test dataset length: {test_len}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.6 Create DataLoaders\n",
|
||
"\n",
|
||
"Generally GPUs aren't the bottleneck of machine learning code.\n",
|
||
"\n",
|
||
"Data loading is the main bottleneck.\n",
|
||
"\n",
|
||
"As in, the transfer speed from CPU to GPU.\n",
|
||
"\n",
|
||
"As we've discussed before you want to get your data to the GPU as fast as possible.\n",
|
||
"\n",
|
||
"Let's create our `DataLoaders` using `torch.utils.data.DataLoader`.\n",
|
||
"\n",
|
||
"We'll set their `batch_size` to the `BATCH_SIZE` we created earlier.\n",
|
||
"\n",
|
||
"And the `num_workers` parameter to be the number of CPU cores we have available with `os.cpu_count()`.\n",
|
||
"\n",
|
||
"> **Note:** You may want to experiment with different values for `num_workers` to see what works best for your specific GPU and CPU setup. In my experience, more is better but some people have found this [generally caps out](https://discuss.pytorch.org/t/guidelines-for-assigning-num-workers-to-dataloader/813/3) at `4 * number_of_gpus_you_have`, for example, `num_workers = 4 * 1` for 1 GPU."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 17,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Train dataloader length: 391 batches of size 128\n",
|
||
"Test dataloader length: 79 batches of size 128\n",
|
||
"Using number of workers: 16 (generally more workers means faster dataloading from CPU to GPU)\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"from torch.utils.data import DataLoader\n",
|
||
"\n",
|
||
"# Create DataLoaders\n",
|
||
"import os\n",
|
||
"NUM_WORKERS = os.cpu_count() # <- use all available CPU cores (this number can be tweaked through experimentation but generally more workers means faster dataloading from CPU to GPU)\n",
|
||
"\n",
|
||
"train_dataloader = DataLoader(dataset=train_dataset,\n",
|
||
" batch_size=BATCH_SIZE,\n",
|
||
" shuffle=True,\n",
|
||
" num_workers=NUM_WORKERS)\n",
|
||
"\n",
|
||
"test_dataloader = DataLoader(dataset=test_dataset,\n",
|
||
" batch_size=BATCH_SIZE,\n",
|
||
" shuffle=False,\n",
|
||
" num_workers=NUM_WORKERS)\n",
|
||
"\n",
|
||
"# Print details\n",
|
||
"print(f\"Train dataloader length: {len(train_dataloader)} batches of size {BATCH_SIZE}\")\n",
|
||
"print(f\"Test dataloader length: {len(test_dataloader)} batches of size {BATCH_SIZE}\")\n",
|
||
"print(f\"Using number of workers: {NUM_WORKERS} (generally more workers means faster dataloading from CPU to GPU)\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 2.7 Create training and testing loops\n",
|
||
"\n",
|
||
"Dataloaders ready!\n",
|
||
"\n",
|
||
"Let's now create some training and testing loops.\n",
|
||
"\n",
|
||
"These will be the same training and testing loops we created in [05. PyTorch Going Modular](https://www.learnpytorch.io/05_pytorch_going_modular/) with some slight modifications.\n",
|
||
"\n",
|
||
"Since we're focused on measuring speed, we're going to add a timing component to each loop to measure how long each takes to complete.\n",
|
||
"\n",
|
||
"We'll do this by measuring the start and end time of each training and testing epoch with Python's [`time.time()`](https://docs.python.org/3/library/time.html#time.time) and tracking it in a dictionary.\n",
|
||
"\n",
|
||
"> **Note:** One thing I found when experimenting with PyTorch 2.0 is that [`torch.inference_mode()`](https://pytorch.org/docs/stable/generated/torch.inference_mode.html) produced errors in the testing loop. So I've changed it to be [`torch.no_grad()`](https://pytorch.org/docs/stable/generated/torch.no_grad.html) which offers similar functionality but is an older method than `torch.inference_mode()`. If you find that `torch.inference_mode()` works for you, please [let me know on GitHub](https://github.com/mrdbourke/pytorch-deep-learning/discussions) and I'll update this notebook."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 18,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"import time\n",
|
||
"from tqdm.auto import tqdm\n",
|
||
"from typing import Dict, List, Tuple\n",
|
||
"\n",
|
||
"def train_step(epoch: int,\n",
|
||
" model: torch.nn.Module, \n",
|
||
" dataloader: torch.utils.data.DataLoader, \n",
|
||
" loss_fn: torch.nn.Module, \n",
|
||
" optimizer: torch.optim.Optimizer,\n",
|
||
" device: torch.device,\n",
|
||
" disable_progress_bar: bool = False) -> Tuple[float, float]:\n",
|
||
" \"\"\"Trains a PyTorch model for a single epoch.\n",
|
||
"\n",
|
||
" Turns a target PyTorch model to training mode and then\n",
|
||
" runs through all of the required training steps (forward\n",
|
||
" pass, loss calculation, optimizer step).\n",
|
||
"\n",
|
||
" Args:\n",
|
||
" model: A PyTorch model to be trained.\n",
|
||
" dataloader: A DataLoader instance for the model to be trained on.\n",
|
||
" loss_fn: A PyTorch loss function to minimize.\n",
|
||
" optimizer: A PyTorch optimizer to help minimize the loss function.\n",
|
||
" device: A target device to compute on (e.g. \"cuda\" or \"cpu\").\n",
|
||
"\n",
|
||
" Returns:\n",
|
||
" A tuple of training loss and training accuracy metrics.\n",
|
||
" In the form (train_loss, train_accuracy). For example:\n",
|
||
"\n",
|
||
" (0.1112, 0.8743)\n",
|
||
" \"\"\"\n",
|
||
" # Put model in train mode\n",
|
||
" model.train()\n",
|
||
"\n",
|
||
" # Setup train loss and train accuracy values\n",
|
||
" train_loss, train_acc = 0, 0\n",
|
||
"\n",
|
||
" # Loop through data loader data batches\n",
|
||
" progress_bar = tqdm(\n",
|
||
" enumerate(dataloader), \n",
|
||
" desc=f\"Training Epoch {epoch}\", \n",
|
||
" total=len(dataloader),\n",
|
||
" disable=disable_progress_bar\n",
|
||
" )\n",
|
||
"\n",
|
||
" for batch, (X, y) in progress_bar:\n",
|
||
" # Send data to target device\n",
|
||
" X, y = X.to(device), y.to(device)\n",
|
||
"\n",
|
||
" # 1. Forward pass\n",
|
||
" y_pred = model(X)\n",
|
||
"\n",
|
||
" # 2. Calculate and accumulate loss\n",
|
||
" loss = loss_fn(y_pred, y)\n",
|
||
" train_loss += loss.item() \n",
|
||
"\n",
|
||
" # 3. Optimizer zero grad\n",
|
||
" optimizer.zero_grad()\n",
|
||
"\n",
|
||
" # 4. Loss backward\n",
|
||
" loss.backward()\n",
|
||
"\n",
|
||
" # 5. Optimizer step\n",
|
||
" optimizer.step()\n",
|
||
"\n",
|
||
" # Calculate and accumulate accuracy metrics across all batches\n",
|
||
" y_pred_class = torch.argmax(torch.softmax(y_pred, dim=1), dim=1)\n",
|
||
" train_acc += (y_pred_class == y).sum().item()/len(y_pred)\n",
|
||
"\n",
|
||
" # Update progress bar\n",
|
||
" progress_bar.set_postfix(\n",
|
||
" {\n",
|
||
" \"train_loss\": train_loss / (batch + 1),\n",
|
||
" \"train_acc\": train_acc / (batch + 1),\n",
|
||
" }\n",
|
||
" )\n",
|
||
"\n",
|
||
"\n",
|
||
" # Adjust metrics to get average loss and accuracy per batch \n",
|
||
" train_loss = train_loss / len(dataloader)\n",
|
||
" train_acc = train_acc / len(dataloader)\n",
|
||
" return train_loss, train_acc\n",
|
||
"\n",
|
||
"def test_step(epoch: int,\n",
|
||
" model: torch.nn.Module, \n",
|
||
" dataloader: torch.utils.data.DataLoader, \n",
|
||
" loss_fn: torch.nn.Module,\n",
|
||
" device: torch.device,\n",
|
||
" disable_progress_bar: bool = False) -> Tuple[float, float]:\n",
|
||
" \"\"\"Tests a PyTorch model for a single epoch.\n",
|
||
"\n",
|
||
" Turns a target PyTorch model to \"eval\" mode and then performs\n",
|
||
" a forward pass on a testing dataset.\n",
|
||
"\n",
|
||
" Args:\n",
|
||
" model: A PyTorch model to be tested.\n",
|
||
" dataloader: A DataLoader instance for the model to be tested on.\n",
|
||
" loss_fn: A PyTorch loss function to calculate loss on the test data.\n",
|
||
" device: A target device to compute on (e.g. \"cuda\" or \"cpu\").\n",
|
||
"\n",
|
||
" Returns:\n",
|
||
" A tuple of testing loss and testing accuracy metrics.\n",
|
||
" In the form (test_loss, test_accuracy). For example:\n",
|
||
"\n",
|
||
" (0.0223, 0.8985)\n",
|
||
" \"\"\"\n",
|
||
" # Put model in eval mode\n",
|
||
" model.eval() \n",
|
||
"\n",
|
||
" # Setup test loss and test accuracy values\n",
|
||
" test_loss, test_acc = 0, 0\n",
|
||
"\n",
|
||
" # Loop through data loader data batches\n",
|
||
" progress_bar = tqdm(\n",
|
||
" enumerate(dataloader), \n",
|
||
" desc=f\"Testing Epoch {epoch}\", \n",
|
||
" total=len(dataloader),\n",
|
||
" disable=disable_progress_bar\n",
|
||
" )\n",
|
||
"\n",
|
||
" # Turn on inference context manager\n",
|
||
" with torch.no_grad(): # no_grad() required for PyTorch 2.0, I found some errors with `torch.inference_mode()`, please let me know if this is not the case\n",
|
||
" # Loop through DataLoader batches\n",
|
||
" for batch, (X, y) in progress_bar:\n",
|
||
" # Send data to target device\n",
|
||
" X, y = X.to(device), y.to(device)\n",
|
||
"\n",
|
||
" # 1. Forward pass\n",
|
||
" test_pred_logits = model(X)\n",
|
||
"\n",
|
||
" # 2. Calculate and accumulate loss\n",
|
||
" loss = loss_fn(test_pred_logits, y)\n",
|
||
" test_loss += loss.item()\n",
|
||
"\n",
|
||
" # Calculate and accumulate accuracy\n",
|
||
" test_pred_labels = test_pred_logits.argmax(dim=1)\n",
|
||
" test_acc += ((test_pred_labels == y).sum().item()/len(test_pred_labels))\n",
|
||
"\n",
|
||
" # Update progress bar\n",
|
||
" progress_bar.set_postfix(\n",
|
||
" {\n",
|
||
" \"test_loss\": test_loss / (batch + 1),\n",
|
||
" \"test_acc\": test_acc / (batch + 1),\n",
|
||
" }\n",
|
||
" )\n",
|
||
"\n",
|
||
" # Adjust metrics to get average loss and accuracy per batch \n",
|
||
" test_loss = test_loss / len(dataloader)\n",
|
||
" test_acc = test_acc / len(dataloader)\n",
|
||
" return test_loss, test_acc\n",
|
||
"\n",
|
||
"def train(model: torch.nn.Module, \n",
|
||
" train_dataloader: torch.utils.data.DataLoader, \n",
|
||
" test_dataloader: torch.utils.data.DataLoader, \n",
|
||
" optimizer: torch.optim.Optimizer,\n",
|
||
" loss_fn: torch.nn.Module,\n",
|
||
" epochs: int,\n",
|
||
" device: torch.device,\n",
|
||
" disable_progress_bar: bool = False) -> Dict[str, List]:\n",
|
||
" \"\"\"Trains and tests a PyTorch model.\n",
|
||
"\n",
|
||
" Passes a target PyTorch models through train_step() and test_step()\n",
|
||
" functions for a number of epochs, training and testing the model\n",
|
||
" in the same epoch loop.\n",
|
||
"\n",
|
||
" Calculates, prints and stores evaluation metrics throughout.\n",
|
||
"\n",
|
||
" Args:\n",
|
||
" model: A PyTorch model to be trained and tested.\n",
|
||
" train_dataloader: A DataLoader instance for the model to be trained on.\n",
|
||
" test_dataloader: A DataLoader instance for the model to be tested on.\n",
|
||
" optimizer: A PyTorch optimizer to help minimize the loss function.\n",
|
||
" loss_fn: A PyTorch loss function to calculate loss on both datasets.\n",
|
||
" epochs: An integer indicating how many epochs to train for.\n",
|
||
" device: A target device to compute on (e.g. \"cuda\" or \"cpu\").\n",
|
||
"\n",
|
||
" Returns:\n",
|
||
" A dictionary of training and testing loss as well as training and\n",
|
||
" testing accuracy metrics. Each metric has a value in a list for \n",
|
||
" each epoch.\n",
|
||
" In the form: {train_loss: [...],\n",
|
||
" train_acc: [...],\n",
|
||
" test_loss: [...],\n",
|
||
" test_acc: [...]} \n",
|
||
" For example if training for epochs=2: \n",
|
||
" {train_loss: [2.0616, 1.0537],\n",
|
||
" train_acc: [0.3945, 0.3945],\n",
|
||
" test_loss: [1.2641, 1.5706],\n",
|
||
" test_acc: [0.3400, 0.2973]} \n",
|
||
" \"\"\"\n",
|
||
" # Create empty results dictionary\n",
|
||
" results = {\"train_loss\": [],\n",
|
||
" \"train_acc\": [],\n",
|
||
" \"test_loss\": [],\n",
|
||
" \"test_acc\": [],\n",
|
||
" \"train_epoch_time\": [],\n",
|
||
" \"test_epoch_time\": []\n",
|
||
" }\n",
|
||
"\n",
|
||
" # Loop through training and testing steps for a number of epochs\n",
|
||
" for epoch in tqdm(range(epochs), disable=disable_progress_bar):\n",
|
||
"\n",
|
||
" # Perform training step and time it\n",
|
||
" train_epoch_start_time = time.time()\n",
|
||
" train_loss, train_acc = train_step(epoch=epoch, \n",
|
||
" model=model,\n",
|
||
" dataloader=train_dataloader,\n",
|
||
" loss_fn=loss_fn,\n",
|
||
" optimizer=optimizer,\n",
|
||
" device=device,\n",
|
||
" disable_progress_bar=disable_progress_bar)\n",
|
||
" train_epoch_end_time = time.time()\n",
|
||
" train_epoch_time = train_epoch_end_time - train_epoch_start_time\n",
|
||
" \n",
|
||
" # Perform testing step and time it\n",
|
||
" test_epoch_start_time = time.time()\n",
|
||
" test_loss, test_acc = test_step(epoch=epoch,\n",
|
||
" model=model,\n",
|
||
" dataloader=test_dataloader,\n",
|
||
" loss_fn=loss_fn,\n",
|
||
" device=device,\n",
|
||
" disable_progress_bar=disable_progress_bar)\n",
|
||
" test_epoch_end_time = time.time()\n",
|
||
" test_epoch_time = test_epoch_end_time - test_epoch_start_time\n",
|
||
"\n",
|
||
" # Print out what's happening\n",
|
||
" print(\n",
|
||
" f\"Epoch: {epoch+1} | \"\n",
|
||
" f\"train_loss: {train_loss:.4f} | \"\n",
|
||
" f\"train_acc: {train_acc:.4f} | \"\n",
|
||
" f\"test_loss: {test_loss:.4f} | \"\n",
|
||
" f\"test_acc: {test_acc:.4f} | \"\n",
|
||
" f\"train_epoch_time: {train_epoch_time:.4f} | \"\n",
|
||
" f\"test_epoch_time: {test_epoch_time:.4f}\"\n",
|
||
" )\n",
|
||
"\n",
|
||
" # Update results dictionary\n",
|
||
" results[\"train_loss\"].append(train_loss)\n",
|
||
" results[\"train_acc\"].append(train_acc)\n",
|
||
" results[\"test_loss\"].append(test_loss)\n",
|
||
" results[\"test_acc\"].append(test_acc)\n",
|
||
" results[\"train_epoch_time\"].append(train_epoch_time)\n",
|
||
" results[\"test_epoch_time\"].append(test_epoch_time)\n",
|
||
"\n",
|
||
" # Return the filled results at the end of the epochs\n",
|
||
" return results"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 3. Time models across single run\n",
|
||
"\n",
|
||
"Training and testing functions ready!\n",
|
||
"\n",
|
||
"Time to start training/evaluating and timing our model.\n",
|
||
"\n",
|
||
"We'll start with the first experiment. "
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 3.1 Experiment 1 - Single run, no compile\n",
|
||
"\n",
|
||
"For experiment 1, we'll use the following parameters: \n",
|
||
"\n",
|
||
"| **Experiment** | **Model** | **Data** | **Epochs** | **Batch size** | **Image size** | **`torch.compile()`** | \n",
|
||
"|----- |-----| -----| -----| -----| -----| -----|\n",
|
||
"| 1 (single run) | ResNet50 | CIFAR10 | 5 | 128 | 224 | No |\n",
|
||
"\n",
|
||
"We'll set the number of epochs to `5` and use a learning rate of `0.003` throughout (you can experiment with different learning rates for better results but we're focused on speed)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 19,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"# Set the number of epochs as a constant\n",
|
||
"NUM_EPOCHS = 5\n",
|
||
"\n",
|
||
"# Set the learning rate as a constant (this can be changed to get better results but for now we're just focused on time)\n",
|
||
"LEARNING_RATE = 0.003"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"> **Note:** Depending on the speed of your GPU, the following code can take a little while to run. For example, it took around 16 minutes on my local NVIDIA TITAN RTX and around 7 minutes on a NVIDIA A100 GPU on Google Colab Pro."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 20,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "2d3932b6a6fa4d659b87ba3d26f412e8",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
" 0%| | 0/5 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "2f544154a5b048d98df936ad18774e38",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 0: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "a48a76ce7d684b5e9efc8b005fd9c05d",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 0: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 1 | train_loss: 0.7734 | train_acc: 0.7333 | test_loss: 0.8021 | test_acc: 0.7477 | train_epoch_time: 184.9701 | test_epoch_time: 12.9893\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "5bc6d82283564dd199bd441333f120f9",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 1: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "892d15bbe3944008be8572592b994128",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 1: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 2 | train_loss: 0.4337 | train_acc: 0.8501 | test_loss: 0.4794 | test_acc: 0.8338 | train_epoch_time: 185.3404 | test_epoch_time: 12.9515\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "ed2bb3f592094bbc81098e44f3fbc335",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 2: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "a74a7d81cdf6474185b4f599d2275c50",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 2: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 3 | train_loss: 0.3055 | train_acc: 0.8944 | test_loss: 0.4282 | test_acc: 0.8533 | train_epoch_time: 185.3870 | test_epoch_time: 13.0559\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "fd4ab8292b1d491a8024b100f0e9235d",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 3: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "4f6dd56062f746f985630fe2eae64435",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 3: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 4 | train_loss: 0.2268 | train_acc: 0.9198 | test_loss: 0.4387 | test_acc: 0.8580 | train_epoch_time: 185.5914 | test_epoch_time: 13.0495\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "801b1f9317664fa2a1128b69b0180cb4",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 4: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "ed406b4b41e54292b23cfef46bac7fdb",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 4: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 5 | train_loss: 0.1723 | train_acc: 0.9395 | test_loss: 0.3901 | test_acc: 0.8754 | train_epoch_time: 185.5304 | test_epoch_time: 13.0517\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create model\n",
|
||
"model, transforms = create_model()\n",
|
||
"model.to(device)\n",
|
||
"\n",
|
||
"# Create loss function and optimizer\n",
|
||
"loss_fn = torch.nn.CrossEntropyLoss()\n",
|
||
"optimizer = torch.optim.Adam(model.parameters(),\n",
|
||
" lr=LEARNING_RATE)\n",
|
||
"\n",
|
||
"# Train model and track results\n",
|
||
"single_run_no_compile_results = train(model=model,\n",
|
||
" train_dataloader=train_dataloader,\n",
|
||
" test_dataloader=test_dataloader,\n",
|
||
" loss_fn=loss_fn,\n",
|
||
" optimizer=optimizer,\n",
|
||
" epochs=NUM_EPOCHS,\n",
|
||
" device=device)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 3.2 Experiment 2 - Single run, with compile\n",
|
||
"\n",
|
||
"Now we'll do the same experiment but this time we'll use `torch.compile()`.\n",
|
||
"\n",
|
||
"| **Experiment** | **Model** | **Data** | **Epochs** | **Batch size** | **Image size** | **`torch.compile()`** | \n",
|
||
"|----- |-----| -----| -----| -----| -----| -----|\n",
|
||
"| 2 (single run) | ResNet50 | CIFAR10 | 5 | 128 | 224 | Yes |\n",
|
||
"\n",
|
||
"> **Note:** Depending on the speed of your GPU, the following code can take a little while to run. For example, it took around 16 minutes on my local NVIDIA TITAN RTX and around 7 minutes on a NVIDIA A100 GPU on Google Colab Pro."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 21,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Time to compile: 0.00491642951965332 | Note: The first time you compile your model, the first few epochs will be slower than subsequent runs.\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "3dffe08523224e548af0d418592dd488",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
" 0%| | 0/5 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "56e51390cff74ffaaaae2c81fa44c734",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 0: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "ccd33c0eb0c749ba84e213c439cae923",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 0: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 1 | train_loss: 0.7585 | train_acc: 0.7364 | test_loss: 0.5852 | test_acc: 0.8004 | train_epoch_time: 196.4621 | test_epoch_time: 21.0730\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "e771faaff76e4aa3a02c50f9a44e4e49",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 1: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "5a449904b51f4196b15c406e94dd4afb",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 1: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 2 | train_loss: 0.4288 | train_acc: 0.8521 | test_loss: 0.5468 | test_acc: 0.8108 | train_epoch_time: 169.9891 | test_epoch_time: 11.0555\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "107e83a661944b5399375e0b9865fffe",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 2: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "a951984d0d8a40f99f65d46ef2991fa9",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 2: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 3 | train_loss: 0.3080 | train_acc: 0.8928 | test_loss: 0.4791 | test_acc: 0.8377 | train_epoch_time: 170.4004 | test_epoch_time: 10.9841\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "c8b835b479934323b714e6c0e9619f44",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 3: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "0e75958332e24018af652c6d52d2f98a",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 3: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 4 | train_loss: 0.2322 | train_acc: 0.9184 | test_loss: 0.5551 | test_acc: 0.8306 | train_epoch_time: 170.1974 | test_epoch_time: 11.0482\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "e41cd029f0184a0c8f635a824f15922f",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Training Epoch 4: 0%| | 0/391 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "b9aeca32a54e49e997424afa99626e77",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
"Testing Epoch 4: 0%| | 0/79 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Epoch: 5 | train_loss: 0.1766 | train_acc: 0.9376 | test_loss: 0.3410 | test_acc: 0.8874 | train_epoch_time: 170.0547 | test_epoch_time: 10.9239\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create model and transforms\n",
|
||
"model, transforms = create_model()\n",
|
||
"model.to(device)\n",
|
||
"\n",
|
||
"# Create loss function and optimizer\n",
|
||
"loss_fn = torch.nn.CrossEntropyLoss()\n",
|
||
"optimizer = torch.optim.Adam(model.parameters(),\n",
|
||
" lr=LEARNING_RATE)\n",
|
||
"\n",
|
||
"# Compile the model and time how long it takes\n",
|
||
"compile_start_time = time.time()\n",
|
||
"\n",
|
||
"### New in PyTorch 2.x ###\n",
|
||
"compiled_model = torch.compile(model)\n",
|
||
"##########################\n",
|
||
"\n",
|
||
"compile_end_time = time.time()\n",
|
||
"compile_time = compile_end_time - compile_start_time\n",
|
||
"print(f\"Time to compile: {compile_time} | Note: The first time you compile your model, the first few epochs will be slower than subsequent runs.\")\n",
|
||
"\n",
|
||
"# Train the compiled model\n",
|
||
"single_run_compile_results = train(model=compiled_model,\n",
|
||
" train_dataloader=train_dataloader,\n",
|
||
" test_dataloader=test_dataloader,\n",
|
||
" loss_fn=loss_fn,\n",
|
||
" optimizer=optimizer,\n",
|
||
" epochs=NUM_EPOCHS,\n",
|
||
" device=device)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 3.3 Compare the results of experiment 1 and 2\n",
|
||
"\n",
|
||
"Nice!\n",
|
||
"\n",
|
||
"We've got two trained models:\n",
|
||
"\n",
|
||
"1. One without `torch.compile()`.\n",
|
||
"2. One with `torch.compile()`.\n",
|
||
"\n",
|
||
"Let's compare the results of each experiment.\n",
|
||
"\n",
|
||
"To do so, we'll first create dataframes of the results of each.\n",
|
||
"\n",
|
||
"Then we'll plot the results of each experiment on a bar chart."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 22,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"# Turn experiment results into dataframes\n",
|
||
"import pandas as pd\n",
|
||
"single_run_no_compile_results_df = pd.DataFrame(single_run_no_compile_results)\n",
|
||
"single_run_compile_results_df = pd.DataFrame(single_run_compile_results)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 23,
|
||
"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>train_loss</th>\n",
|
||
" <th>train_acc</th>\n",
|
||
" <th>test_loss</th>\n",
|
||
" <th>test_acc</th>\n",
|
||
" <th>train_epoch_time</th>\n",
|
||
" <th>test_epoch_time</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>0.773435</td>\n",
|
||
" <td>0.733272</td>\n",
|
||
" <td>0.802100</td>\n",
|
||
" <td>0.747725</td>\n",
|
||
" <td>184.970135</td>\n",
|
||
" <td>12.989331</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>0.433699</td>\n",
|
||
" <td>0.850052</td>\n",
|
||
" <td>0.479412</td>\n",
|
||
" <td>0.833762</td>\n",
|
||
" <td>185.340373</td>\n",
|
||
" <td>12.951483</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>0.305494</td>\n",
|
||
" <td>0.894429</td>\n",
|
||
" <td>0.428212</td>\n",
|
||
" <td>0.853343</td>\n",
|
||
" <td>185.386973</td>\n",
|
||
" <td>13.055891</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>0.226751</td>\n",
|
||
" <td>0.919829</td>\n",
|
||
" <td>0.438668</td>\n",
|
||
" <td>0.857991</td>\n",
|
||
" <td>185.591368</td>\n",
|
||
" <td>13.049541</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>0.172269</td>\n",
|
||
" <td>0.939482</td>\n",
|
||
" <td>0.390148</td>\n",
|
||
" <td>0.875396</td>\n",
|
||
" <td>185.530370</td>\n",
|
||
" <td>13.051713</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" train_loss train_acc test_loss test_acc train_epoch_time \\\n",
|
||
"0 0.773435 0.733272 0.802100 0.747725 184.970135 \n",
|
||
"1 0.433699 0.850052 0.479412 0.833762 185.340373 \n",
|
||
"2 0.305494 0.894429 0.428212 0.853343 185.386973 \n",
|
||
"3 0.226751 0.919829 0.438668 0.857991 185.591368 \n",
|
||
"4 0.172269 0.939482 0.390148 0.875396 185.530370 \n",
|
||
"\n",
|
||
" test_epoch_time \n",
|
||
"0 12.989331 \n",
|
||
"1 12.951483 \n",
|
||
"2 13.055891 \n",
|
||
"3 13.049541 \n",
|
||
"4 13.051713 "
|
||
]
|
||
},
|
||
"execution_count": 23,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Check out the head of one of the results dataframes\n",
|
||
"single_run_no_compile_results_df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Got the results for experiments 1 and 2!\n",
|
||
"\n",
|
||
"Now let's write a function to take in the results and compare them with a bar chart.\n",
|
||
"\n",
|
||
"We'll add some metadata to the function so it can display some information about the experiments.\n",
|
||
"\n",
|
||
"Namely all of the parameters in our experiment setup:\n",
|
||
"* The dataset name.\n",
|
||
"* The model name.\n",
|
||
"* The number of epochs.\n",
|
||
"* The batch size.\n",
|
||
"* The image size."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 24,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"# Create filename to save the results\n",
|
||
"DATASET_NAME = \"CIFAR10\"\n",
|
||
"MODEL_NAME = \"ResNet50\""
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 25,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"import matplotlib.pyplot as plt\n",
|
||
"import numpy as np\n",
|
||
"\n",
|
||
"def plot_mean_epoch_times(non_compiled_results: pd.DataFrame, \n",
|
||
" compiled_results: pd.DataFrame, \n",
|
||
" multi_runs: bool=False, \n",
|
||
" num_runs: int=0, \n",
|
||
" save: bool=False, \n",
|
||
" save_path: str=\"\",\n",
|
||
" dataset_name: str=DATASET_NAME,\n",
|
||
" model_name: str=MODEL_NAME,\n",
|
||
" num_epochs: int=NUM_EPOCHS,\n",
|
||
" image_size: int=IMAGE_SIZE,\n",
|
||
" batch_size: int=BATCH_SIZE) -> plt.figure:\n",
|
||
" \n",
|
||
" # Get the mean epoch times from the non-compiled models\n",
|
||
" mean_train_epoch_time = non_compiled_results.train_epoch_time.mean()\n",
|
||
" mean_test_epoch_time = non_compiled_results.test_epoch_time.mean()\n",
|
||
" mean_results = [mean_train_epoch_time, mean_test_epoch_time]\n",
|
||
"\n",
|
||
" # Get the mean epoch times from the compiled models\n",
|
||
" mean_compile_train_epoch_time = compiled_results.train_epoch_time.mean()\n",
|
||
" mean_compile_test_epoch_time = compiled_results.test_epoch_time.mean()\n",
|
||
" mean_compile_results = [mean_compile_train_epoch_time, mean_compile_test_epoch_time]\n",
|
||
"\n",
|
||
" # Calculate the percentage difference between the mean compile and non-compile train epoch times\n",
|
||
" train_epoch_time_diff = mean_compile_train_epoch_time - mean_train_epoch_time\n",
|
||
" train_epoch_time_diff_percent = (train_epoch_time_diff / mean_train_epoch_time) * 100\n",
|
||
"\n",
|
||
" # Calculate the percentage difference between the mean compile and non-compile test epoch times\n",
|
||
" test_epoch_time_diff = mean_compile_test_epoch_time - mean_test_epoch_time\n",
|
||
" test_epoch_time_diff_percent = (test_epoch_time_diff / mean_test_epoch_time) * 100\n",
|
||
"\n",
|
||
" # Print the mean difference percentages\n",
|
||
" print(f\"Mean train epoch time difference: {round(train_epoch_time_diff_percent, 3)}% (negative means faster)\")\n",
|
||
" print(f\"Mean test epoch time difference: {round(test_epoch_time_diff_percent, 3)}% (negative means faster)\")\n",
|
||
"\n",
|
||
" # Create a bar plot of the mean train and test epoch time for both compiled and non-compiled models\n",
|
||
" plt.figure(figsize=(10, 7))\n",
|
||
" width = 0.3\n",
|
||
" x_indicies = np.arange(len(mean_results))\n",
|
||
"\n",
|
||
" plt.bar(x=x_indicies, height=mean_results, width=width, label=\"non_compiled_results\")\n",
|
||
" plt.bar(x=x_indicies + width, height=mean_compile_results, width=width, label=\"compiled_results\")\n",
|
||
" plt.xticks(x_indicies + width / 2, (\"Train Epoch\", \"Test Epoch\"))\n",
|
||
" plt.ylabel(\"Mean epoch time (seconds, lower is better)\")\n",
|
||
"\n",
|
||
" # Create the title based on the parameters passed to the function\n",
|
||
" if multi_runs:\n",
|
||
" plt.suptitle(\"Multiple run results\")\n",
|
||
" plt.title(f\"GPU: {gpu_name} | Epochs: {num_epochs} ({num_runs} runs) | Data: {dataset_name} | Model: {model_name} | Image size: {image_size} | Batch size: {batch_size}\")\n",
|
||
" else:\n",
|
||
" plt.suptitle(\"Single run results\")\n",
|
||
" plt.title(f\"GPU: {gpu_name} | Epochs: {num_epochs} | Data: {dataset_name} | Model: {model_name} | Image size: {image_size} | Batch size: {batch_size}\")\n",
|
||
" plt.legend();\n",
|
||
"\n",
|
||
" # Save the figure\n",
|
||
" if save:\n",
|
||
" assert save_path != \"\", \"Please specify a save path to save the model figure to via the save_path parameter.\"\n",
|
||
" plt.savefig(save_path)\n",
|
||
" print(f\"[INFO] Plot saved to {save_path}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Plot function ready!\n",
|
||
"\n",
|
||
"Let's create a directory to store our figures in and then plot the results of our first two experiments."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 26,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Save path for single run results: pytorch_2_results/figures/single_run_NVIDIA_TITAN_RTX_ResNet50_CIFAR10_224_train_epoch_time.png\n",
|
||
"Mean train epoch time difference: -5.364% (negative means faster)\n",
|
||
"Mean test epoch time difference: -0.02% (negative means faster)\n",
|
||
"[INFO] Plot saved to pytorch_2_results/figures/single_run_NVIDIA_TITAN_RTX_ResNet50_CIFAR10_224_train_epoch_time.png\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAokAAAHOCAYAAAD0YpNoAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABJT0lEQVR4nO3dd5hcZdn48e9NEgi9RqUnIKFJCBB4QVqQJkUEBAFDCUh7BSk2ig18QREQBUUi/KQpVUAFQYx0VBATCCX0EiD0FggtknD//jhnw2Rny9nsTmZJvp/r2mtnTnmee2bOnLnnKWciM5EkSZJqzdXsACRJktT7mCRKkiSpjkmiJEmS6pgkSpIkqY5JoiRJkuqYJEqSJKmOSaKkbomIERExuofKuiUi9u+Jsj6uImJCRGzR7DgkySRRUqciYqOI+FdEvBkRr0fEPyNiXYDMvCgzt2p2jLOjiDguIn7f7DgkzZn6NjsASb1bRCwE/AX4X+ByYG5gY2BKM+PqSET0zcypH9fyJak3sCVRUmcGA2TmJZk5LTPfy8zRmXkfQESMjIh/tGwcERkRB0fEYxHxRkScGRFRrusTET+LiFcj4qmIOLTcvs0vrBGxX0Q8VJbzt4hYvp3tBpblfDUingFuiojhETGx1XbTu3LLVrrLI+LCiJgcEeMjYlh7T0JZ/iER8RjwWLls+4gYFxGTypbW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C/h7FM/t0RTnmvfKZdD56/ctis+Hx8q6t6XolWpX5AzDY6TGieISDcPLFr6Z2Xf/zLyhh8Nquigudn5c2TKuJunO8aneIYqLC9+Smec3OY5tgFGZuXynG8+hopjFfktmDmxyKOqAP8snSVI3lN3225ZdgUtTtHb+sdlxSd1lkqhZ6Rd8NMZGHzmf8hqMaqpf4PH5cfcnZrz23awSFN2fb1B0Nz8E/KAJcXycTKJ4z6kXs7tZkiRJdWxJlCRJUp32ZhB+LCyxxBI5cODAZochSZLUqbFjx76amY3+4Y0e87FOEgcOHMiYMWOaHYYkSVKnIuLpzrfqPexuliRJUh2TREmSJNUxSZQkSVKdj/WYREmSGuWDDz5g4sSJvP9+3a8SSh3q378/yyyzDP369Wt2KN1ikihJUhsmTpzIggsuyMCBA4mIZoejj4nM5LXXXmPixIkMGjSo2eF0i93NkiS14f3332fxxRc3QVSXRASLL774bNECbZIoSVI7TBA1M2aX48YkUZIkSXUckyhJUgUDj762R8ubcNJ2PVqe1NNsSZQkSQ237bbbMmnSJAAWWGCBLu173HHHceqppzYgqo61xDlhwgQuvvjiWV5/s5kkSpKkhrvuuutYZJFFGl7P1KlTe7xMk0RJktSrTJgwgVVXXZUDDjiA1Vdfna222or33nuPcePGsf766zNkyBB22mkn3njjDQCGDx/OUUcdxXrrrcfgwYO5/fbb2y172rRpfOtb32KNNdZgyJAh/PKXvwTgxhtvZK211mKNNdZgv/32Y8qUKQAMHDiQY489lg022IBhw4Zx9913s/XWW7PiiisyatQoAG655RY22WQTdtppJ1ZbbTUOPvhgPvzww+n7v/rqq3VxnHLKKay77roMGTKEH/7wh9OXn3jiiay88spsscUWPPLIIx0+T8OHD+fYY49l00035fTTT2fs2LFsuummrLPOOmy99da88MILAJxxxhmsttpqDBkyhN133x2ob6X8zGc+w4QJE2Yo/+ijj+b2229n6NCh/PznP2f8+PGst956DB06lCFDhvDYY491GN/HlUmiJEm92GOPPcYhhxzC+PHjWWSRRbjyyivZe++9+elPf8p9993HGmuswfHHHz99+6lTp3LXXXfxi1/8YoblrZ199tk89dRT3HPPPdx3332MGDGC999/n5EjR3LZZZdx//33M3XqVM4666zp+yy77LLccccdbLzxxowcOZIrrriCO++8kx/84AfTt7nrrrv42c9+xv33388TTzzBVVdd1W4Mo0eP5rHHHuOuu+5i3LhxjB07lttuu42xY8dy6aWXcs8993DVVVfxn//8p9PnadKkSdx6660cdthhfP3rX+eKK65g7Nix7Lfffnz3u98F4KSTTpr+eFsS2ypOOukkNt54Y8aNG8eRRx7JqFGjOPzwwxk3bhxjxoxhmWWWqVzWx4kTVyRJ6sUGDRrE0KFDAVhnnXV44oknmDRpEptuuikA++yzD7vuuuv07Xfeeefp27ZuEat1ww03cPDBB9O3b5EKLLbYYtx7770MGjSIwYMHTy/7zDPP5IgjjgBghx12AGCNNdbg7bffZsEFF2TBBRekf//+08cbrrfeeqywwgoA7LHHHvzjH/9gl112aTOG0aNHM3r0aNZaay0A3n77bR577DEmT57MTjvtxHzzzTdDvR3ZbbfdAHjkkUd44IEH2HLLLYGixXTJJZcEYMiQIYwYMYIdd9yRHXfcsdMy27PBBhtw4oknMnHiRHbeeWdWWmmlmS6rN7MlUZKkXmyeeeaZfrtPnz7Tk7HOtu/Tp0+H4/Mys+56fplZqey55pprhrjmmmuu6XW1LrOjawZmJscccwzjxo1j3LhxPP7443z1q1/tdL+2zD///NPLXH311aeXef/99zN69GgArr32Wg455BDGjh3LOuusw9SpU+nbt+/0LnGg0kWwv/KVr3D11Vcz77zzsvXWW3PTTTd1KdaPC1sSJUmqoLdcsmbhhRdm0UUX5fbbb2fjjTfmd7/73fRWxa7YaqutGDVqFMOHD6dv3768/vrrrLLKKkyYMIHHH3+cT3/60zNV9l133cVTTz3F8ssvz2WXXcaBBx7Y7rZbb7013//+9xkxYgQLLLAAzz33HP369WOTTTZh5MiRHH300UydOpVrrrmGgw46qFL9K6+8Mq+88gp33HEHG2ywAR988AGPPvooq666Ks8++yybbbYZG220ERdffDFvv/02AwcO5C9/+QsAd999N0899VRdmQsuuCCTJ0+efv/JJ59khRVW4LDDDuPJJ5/kvvvu43Of+1yXnqePA5PECnr62liqrreclCWpN7ngggs4+OCDeffdd1lhhRU477zzulzG/vvvz6OPPsqQIUPo168fBxxwAIceeijnnXceu+66K1OnTmXdddfl4IMP7lK5G2ywAUcffTT333//9Eks7dlqq6146KGH2GCDDYDikjO///3vWXvttdltt90YOnQoyy+/PBtvvHHl+ueee26uuOIKDjvsMN58802mTp3KEUccweDBg9lzzz158803yUyOPPJIFllkEb70pS9x4YUXMnToUNZdd93pXe21hgwZQt++fVlzzTUZOXIk77//Pr///e/p168fn/rUp2YYkzk7ic6alnuzYcOG5ZgxYxpej0li85gkSmqWhx56iFVXXbXZYXys3HLLLZx66qnTW+bmZG0dPxExNjOHNSmkLnNMoiRJkurY3SxJ0mzsb3/7G0cdddQMywYNGsQf//jHHq9r+PDhDB8+vMfLbXHIIYfwz3/+c4Zlhx9+OPvuu2/D6pyTmSRKkjQb23rrrdl6662bHUaPOPPMM5sdwhzF7mZJkiTVMUmUJElSHZNESZIk1XFMoiRJVRy3cA+X92bPltdNP/jBD9hkk03YYostGD58OKeeeirDhlW7WkuzLn1TG+ePf/xjjj322Fla/+zOlkRJksSPfvQjtthii4bX09FPBXbHj3/844aUOyczSZQkqRe78MILGTJkCGuuuSZ77bUXTz/9NJtvvjlDhgxh880355lnngFg5MiR/O///i+bbbYZK6ywArfeeiv77bcfq666KiNHjpxe3gILLMA3v/lN1l57bTbffHNeeeWV6ftfccUVdfWPHj2aDTbYgLXXXptdd92Vt99+G4Drr7+eVVZZhY022oirrrqqw8dw3HHHceCBB7LVVlux995788orr/ClL32Jddddl3XXXXf6ZW1uvfVWhg4dytChQ1lrrbWYPHkyt9xyC9tvv/30sg499FDOP//8Gco/+uijee+99xg6dCgjRozgnXfeYbvttmPNNdfkM5/5DJdddlmXn3eZJEqS1GuNHz+eE088kZtuuol7772X008/nUMPPZS9996b++67jxEjRnDYYYdN3/6NN97gpptu4uc//zlf+MIXOPLIIxk/fjz3338/48aNA+Cdd95h7bXX5u6772bTTTfl+OOPb7f+V199lRNOOIEbbriBu+++m2HDhnHaaafx/vvvc8ABB3DNNddw++238+KLL3b6WMaOHcuf//xnLr74Yg4//HCOPPJI/vOf/3DllVey//77A3Dqqady5plnMm7cOG6//XbmnXfeSs/TSSedxLzzzsu4ceO46KKLuP7661lqqaW49957eeCBB/j85z9fqRzNyCRRkqRe6qabbmKXXXZhiSWWAGCxxRbjjjvu4Ctf+QoAe+21F//4xz+mb/+FL3yBiGCNNdbgk5/8JGussQZzzTUXq6++OhMmTABgrrnmYrfddgNgzz33nGH/1u68804efPBBNtxwQ4YOHcoFF1zA008/zcMPP8ygQYNYaaWViAj23HPPTh/LDjvsMD3pu+GGGzj00EMZOnQoO+ywA2+99RaTJ09mww035Bvf+AZnnHEGkyZNom/fmZs6scYaa3DDDTdw1FFHcfvtt7Pwwj08nnQO4cQVSZJ6qcwkIjrcpnb9PPPMAxSJYMvtlvvtjQXsqPzMZMstt+SSSy6ZYfm4ceM6jau1+eeff/rtDz/8kDvuuKOupfDoo49mu+2247rrrmP99dfnhhtuoG/fvnz44YfTt3n//fc7rWvw4MGMHTuW6667jmOOOYatttqKH/zgB12KV7YkSpLUa22++eZcfvnlvPbaawC8/vrrfPazn+XSSy8F4KKLLmKjjTbqUpkffvjh9LGHF198cYf7r7/++vzzn//k8ccfB+Ddd9/l0UcfZZVVVuGpp57iiSeeAKhLIjuz1VZb8atf/Wr6/Zau8CeeeII11liDo446imHDhvHwww+z/PLL8+CDDzJlyhTefPNNbrzxxjbL7NevHx988AEAzz//PPPNNx977rkn3/rWt7j77ru7FJ8KtiRKklRFEy5Zs/rqq/Pd736XTTfdlD59+rDWWmtxxhlnsN9++3HKKacwYMAAzjvvvC6VOf/88zN+/HjWWWcdFl544Q4ndQwYMIDzzz+fPfbYgylTpgBwwgknMHjwYM4++2y22247llhiCTbaaCMeeOCByjGcccYZHHLIIQwZMoSpU6eyySabMGrUKH7xi19w880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fQDckpmvlMsvAjahGCd5W2Y+BZCZr9cUV/V8K83AJFE94Z2a2/8H3JyZO5XdLLe0s8+UmtvT6Pqx2PraTUn7v/0dbWwP8EF+dA2omYlB0pwpgPGZuUEb67ajSNp2AL4fEat3o56q57mWmNq7pl13z7eaQzkmUT1tYT6apTeygfXsBlB20byZmW8CtwEjyuXDgVcz8y1gNDD9W3pNd7MkzYwpwICI2AAgIvpFxOrlmMFlM/Nm4DvAIsACFFdpWHAm6lmv/JnauSjOef8A/g1sGhFLREQfYA/gVuCOcvmgMqbF2itUqsokUT3tZOAnEfFPii6Y7rq5HOw9LiIurFn+Rjk2ZxTw1XLZccCwiLgPOAnYp1x+ArBoOcj7XoqxOZI0sz4EdqGYrHcvMA74LMU57/cRcT9wD/DzzJwEXAPs1MHEld1qznPjIuKz5fI7KM5lDwBPAX/MzBeAY4CbgXuBuzPzz2X384HAVWVMlzXkkWuO4i+u6GMnIm4BvlVeVkeSZjtlb8i3MnP7JoeiOZgtiZIkSapjS6IkSZLq2JIoSZKkOiaJkiRJqmOSKEmSpDomiZIkSapjkihJkqQ6JomSJEmq8/8BJrmdApZexgMAAAAASUVORK5CYII=",
|
||
"text/plain": [
|
||
"<Figure size 720x504 with 1 Axes>"
|
||
]
|
||
},
|
||
"metadata": {
|
||
"needs_background": "light"
|
||
},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create directory for saving figures\n",
|
||
"import os\n",
|
||
"dir_to_save_figures_in = \"pytorch_2_results/figures/\" \n",
|
||
"os.makedirs(dir_to_save_figures_in, exist_ok=True)\n",
|
||
"\n",
|
||
"# Create a save path for the single run results\n",
|
||
"save_path_multi_run = f\"{dir_to_save_figures_in}single_run_{GPU_NAME}_{MODEL_NAME}_{DATASET_NAME}_{IMAGE_SIZE}_train_epoch_time.png\"\n",
|
||
"print(f\"[INFO] Save path for single run results: {save_path_multi_run}\")\n",
|
||
"\n",
|
||
"# Plot the results and save the figures\n",
|
||
"plot_mean_epoch_times(non_compiled_results=single_run_no_compile_results_df, \n",
|
||
" compiled_results=single_run_compile_results_df, \n",
|
||
" multi_runs=False, \n",
|
||
" save_path=save_path_multi_run, \n",
|
||
" save=True)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Hmm... what's happening here?\n",
|
||
"\n",
|
||
"It looks like the model with `torch.compile()` took *longer* than the model without it (on an A100, this is the case, but on my local NVIDIA TITAN RTX, the compiled model is slightly faster).\n",
|
||
"\n",
|
||
"Why might this be the case?\n",
|
||
"\n",
|
||
"Well on a per epoch time we can see that although experiment 2 (with `torch.compile()`) was far slower for the first epoch, it started being faster than experiment 1 (without `torch.compile()`) for subsequent epochs.\n",
|
||
"\n",
|
||
"This is because behind the scenes `torch.compile()` spends the first steps of a training run \"warming up\" the model and performing optimization steps behind the scenes.\n",
|
||
"\n",
|
||
"These **optimization steps take time up front** but mean **subsequent steps should be faster**.\n",
|
||
"\n",
|
||
"To test if this is true, you could try training the model above for longer (say 50 epochs rather than 5) and see what the average training times come out to be."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 3.4 Save single run results to file with GPU details\n",
|
||
"\n",
|
||
"We can save the raw data of our results to file too by exporting the dataframes as CSVs.\n",
|
||
"\n",
|
||
"We'll first create a directory for storing results.\n",
|
||
"\n",
|
||
"Then we'll create filepaths to save each of the target dataframes to before exporting them."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 27,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Saving non-compiled experiment 1 results to: pytorch_2_results/single_run_results/single_run_non_compiled_results_CIFAR10_ResNet50_NVIDIA_TITAN_RTX.csv\n",
|
||
"[INFO] Saving compiled experiment 2 results to: pytorch_2_results/single_run_results/single_run_compiled_results_CIFAR10_ResNet50_NVIDIA_TITAN_RTX.csv\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Make a directory for single_run results\n",
|
||
"import os\n",
|
||
"pytorch_2_results_dir = \"pytorch_2_results\"\n",
|
||
"pytorch_2_single_run_results_dir = f\"{pytorch_2_results_dir}/single_run_results\"\n",
|
||
"os.makedirs(pytorch_2_single_run_results_dir, exist_ok=True)\n",
|
||
"\n",
|
||
"# Create filenames for each of the dataframes\n",
|
||
"save_name_for_non_compiled_results = f\"single_run_non_compiled_results_{DATASET_NAME}_{MODEL_NAME}_{GPU_NAME}.csv\"\n",
|
||
"save_name_for_compiled_results = f\"single_run_compiled_results_{DATASET_NAME}_{MODEL_NAME}_{GPU_NAME}.csv\"\n",
|
||
"\n",
|
||
"# Create filepaths to save the results to\n",
|
||
"single_run_no_compile_save_path = f\"{pytorch_2_single_run_results_dir}/{save_name_for_non_compiled_results}\"\n",
|
||
"single_run_compile_save_path = f\"{pytorch_2_single_run_results_dir}/{save_name_for_compiled_results}\"\n",
|
||
"print(f\"[INFO] Saving non-compiled experiment 1 results to: {single_run_no_compile_save_path}\")\n",
|
||
"print(f\"[INFO] Saving compiled experiment 2 results to: {single_run_compile_save_path}\")\n",
|
||
"\n",
|
||
"# Save the results\n",
|
||
"single_run_no_compile_results_df.to_csv(single_run_no_compile_save_path)\n",
|
||
"single_run_compile_results_df.to_csv(single_run_compile_save_path)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 4. Time models across multiple runs\n",
|
||
"\n",
|
||
"Now we've tested our model with a single run with `torch.compile()` on and off, let's do the same for multiple runs.\n",
|
||
"\n",
|
||
"We're going to start by creating three functions for experiments 3 and 4.\n",
|
||
"\n",
|
||
"1. **Experiment 3:** `create_and_train_non_compiled_model()` - this function will be similar to the workflow we've used for the single runs. We'll put the model creation (via `create_model()`) and training in a single function so we can call it multiple times (for multiple runs) and measure the time of each run.\n",
|
||
"2. **Experiment 4:** `create_compiled_model()` - this function will be similar to the `create_model()` function above, however, it will create a normal PyTorch model and then call `torch.compile()` on it and return it.\n",
|
||
"3. **Experiment 4:** `train_compiled_model()` - this function will take in a compiled model and train it in the same way we've been training our models for single runs.\n",
|
||
"\n",
|
||
"Why separate functions 2 and 3 (`create_compiled_model()` and `train_compiled_model()`) for experiment 4?\n",
|
||
"\n",
|
||
"Because calling `torch.compile()` on model means that for the first few runs, the model will be \"warming up\" as PyTorch calculates a bunch of optimization steps behind the scenes.\n",
|
||
"\n",
|
||
"So in practice, you'll generally want to compile up front *once* and then train/perform inference with an already compiled model."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 28,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"def create_and_train_non_compiled_model(epochs=NUM_EPOCHS, \n",
|
||
" learning_rate=LEARNING_RATE, \n",
|
||
" disable_progress_bar=False):\n",
|
||
" \"\"\"\n",
|
||
" Create and train a non-compiled PyTorch model.\n",
|
||
" \"\"\"\n",
|
||
" model, _ = create_model()\n",
|
||
" model.to(device)\n",
|
||
"\n",
|
||
" loss_fn = torch.nn.CrossEntropyLoss()\n",
|
||
" optimizer = torch.optim.Adam(model.parameters(),\n",
|
||
" lr=learning_rate)\n",
|
||
"\n",
|
||
" results = train(model=model,\n",
|
||
" train_dataloader=train_dataloader,\n",
|
||
" test_dataloader=test_dataloader,\n",
|
||
" loss_fn=loss_fn,\n",
|
||
" optimizer=optimizer,\n",
|
||
" epochs=epochs,\n",
|
||
" device=device,\n",
|
||
" disable_progress_bar=disable_progress_bar)\n",
|
||
" return results\n",
|
||
"\n",
|
||
"def create_compiled_model():\n",
|
||
" \"\"\"\n",
|
||
" Create a compiled PyTorch model and return it.\n",
|
||
" \"\"\"\n",
|
||
" model, _ = create_model()\n",
|
||
" model.to(device)\n",
|
||
" \n",
|
||
" compile_start_time = time.time()\n",
|
||
" ### New in PyTorch 2.x ###\n",
|
||
" compiled_model = torch.compile(model)\n",
|
||
" ##########################\n",
|
||
" compile_end_time = time.time()\n",
|
||
"\n",
|
||
" compile_time = compile_end_time - compile_start_time\n",
|
||
"\n",
|
||
" print(f\"Time to compile: {compile_time} | Note: The first time you compile your model, the first few epochs will be slower than subsequent runs.\")\n",
|
||
" return compiled_model\n",
|
||
"\n",
|
||
"def train_compiled_model(model=compiled_model, \n",
|
||
" epochs=NUM_EPOCHS, \n",
|
||
" learning_rate=LEARNING_RATE,\n",
|
||
" disable_progress_bar=False):\n",
|
||
" \"\"\"\n",
|
||
" Train a compiled model and return the results.\n",
|
||
" \"\"\"\n",
|
||
" loss_fn = torch.nn.CrossEntropyLoss()\n",
|
||
" optimizer = torch.optim.Adam(compiled_model.parameters(),\n",
|
||
" lr=learning_rate)\n",
|
||
" \n",
|
||
" compile_results = train(model=model,\n",
|
||
" train_dataloader=train_dataloader,\n",
|
||
" test_dataloader=test_dataloader,\n",
|
||
" loss_fn=loss_fn,\n",
|
||
" optimizer=optimizer,\n",
|
||
" epochs=epochs,\n",
|
||
" device=device,\n",
|
||
" disable_progress_bar=disable_progress_bar)\n",
|
||
" \n",
|
||
" return compile_results"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 4.1 Experiment 3 - Multiple runs, no compile\n",
|
||
"\n",
|
||
"Functions ready for experiment 3 and 4! \n",
|
||
"\n",
|
||
"Let's start with experiment 3.\n",
|
||
"\n",
|
||
"| **Experiment** | **Model** | **Data** | **Epochs** | **Batch size** | **Image size** | **`torch.compile()`** | \n",
|
||
"|----- |-----| -----| -----| -----| -----| -----|\n",
|
||
"| 3 (multi-run) | ResNet50 | CIFAR10 | 3x5 | 128 | 224 | No |\n",
|
||
"\n",
|
||
"We'll set the number of runs to 3 and the number of epochs to 5.\n",
|
||
"\n",
|
||
"We'll create an empty list to store the results and append the results of each run to it after each run.\n",
|
||
"\n",
|
||
"> **Note:** Running the following code can take quite a while depending on the speed of your GPU, for me, it took 20 minutes on a NVIDIA A100 on Google Colab Pro and around 49 minutes on a NVIDIA TITAN RTX."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 29,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "4108ca563be14d4a8ed57c3de1697ebd",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
" 0%| | 0/3 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Run 1 of 3 for non-compiled model\n",
|
||
"Epoch: 1 | train_loss: 0.8242 | train_acc: 0.7136 | test_loss: 0.5486 | test_acc: 0.8124 | train_epoch_time: 185.1112 | test_epoch_time: 12.9925\n",
|
||
"Epoch: 2 | train_loss: 0.4415 | train_acc: 0.8479 | test_loss: 0.6415 | test_acc: 0.7829 | train_epoch_time: 185.0138 | test_epoch_time: 12.9690\n",
|
||
"Epoch: 3 | train_loss: 0.3229 | train_acc: 0.8882 | test_loss: 0.4486 | test_acc: 0.8488 | train_epoch_time: 185.0366 | test_epoch_time: 12.9433\n",
|
||
"Epoch: 4 | train_loss: 0.2433 | train_acc: 0.9151 | test_loss: 0.4376 | test_acc: 0.8596 | train_epoch_time: 185.0900 | test_epoch_time: 12.9465\n",
|
||
"Epoch: 5 | train_loss: 0.1785 | train_acc: 0.9379 | test_loss: 0.4305 | test_acc: 0.8641 | train_epoch_time: 185.0405 | test_epoch_time: 13.0102\n",
|
||
"[INFO] Run 2 of 3 for non-compiled model\n",
|
||
"Epoch: 1 | train_loss: 0.8304 | train_acc: 0.7101 | test_loss: 0.6132 | test_acc: 0.7884 | train_epoch_time: 185.0911 | test_epoch_time: 13.0429\n",
|
||
"Epoch: 2 | train_loss: 0.4602 | train_acc: 0.8411 | test_loss: 0.6183 | test_acc: 0.7907 | train_epoch_time: 185.0738 | test_epoch_time: 12.9596\n",
|
||
"Epoch: 3 | train_loss: 0.3283 | train_acc: 0.8869 | test_loss: 0.4309 | test_acc: 0.8534 | train_epoch_time: 185.0462 | test_epoch_time: 12.9877\n",
|
||
"Epoch: 4 | train_loss: 0.2474 | train_acc: 0.9140 | test_loss: 0.4525 | test_acc: 0.8565 | train_epoch_time: 184.9521 | test_epoch_time: 12.9942\n",
|
||
"Epoch: 5 | train_loss: 0.1860 | train_acc: 0.9360 | test_loss: 0.6284 | test_acc: 0.8195 | train_epoch_time: 184.9911 | test_epoch_time: 12.9369\n",
|
||
"[INFO] Run 3 of 3 for non-compiled model\n",
|
||
"Epoch: 1 | train_loss: 0.7915 | train_acc: 0.7246 | test_loss: 0.6102 | test_acc: 0.7894 | train_epoch_time: 184.9795 | test_epoch_time: 13.0175\n",
|
||
"Epoch: 2 | train_loss: 0.4394 | train_acc: 0.8477 | test_loss: 0.5958 | test_acc: 0.7968 | train_epoch_time: 184.9266 | test_epoch_time: 12.9909\n",
|
||
"Epoch: 3 | train_loss: 0.3156 | train_acc: 0.8893 | test_loss: 0.4299 | test_acc: 0.8547 | train_epoch_time: 185.1226 | test_epoch_time: 12.9396\n",
|
||
"Epoch: 4 | train_loss: 0.2371 | train_acc: 0.9163 | test_loss: 0.4185 | test_acc: 0.8608 | train_epoch_time: 184.9447 | test_epoch_time: 12.9673\n",
|
||
"Epoch: 5 | train_loss: 0.1739 | train_acc: 0.9389 | test_loss: 0.3797 | test_acc: 0.8805 | train_epoch_time: 184.9552 | test_epoch_time: 13.0328\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Run non-compiled model for multiple runs\n",
|
||
"NUM_RUNS = 3\n",
|
||
"NUM_EPOCHS = 5\n",
|
||
"\n",
|
||
"# Create an empty list to store multiple run results\n",
|
||
"non_compile_results_multiple_runs = []\n",
|
||
"\n",
|
||
"# Run non-compiled model for multiple runs\n",
|
||
"for i in tqdm(range(NUM_RUNS)):\n",
|
||
" print(f\"[INFO] Run {i+1} of {NUM_RUNS} for non-compiled model\")\n",
|
||
" results = create_and_train_non_compiled_model(epochs=NUM_EPOCHS, disable_progress_bar=True)\n",
|
||
" non_compile_results_multiple_runs.append(results)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Now we've got a list of results from experiment 3, let's iterate through them and create a dataframe containing all of the results.\n",
|
||
"\n",
|
||
"We'll then average the results across the 3 runs by grouping by the epoch number (the index of the dataframe) and taking the mean of the results."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 30,
|
||
"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>train_loss</th>\n",
|
||
" <th>train_acc</th>\n",
|
||
" <th>test_loss</th>\n",
|
||
" <th>test_acc</th>\n",
|
||
" <th>train_epoch_time</th>\n",
|
||
" <th>test_epoch_time</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>0.815352</td>\n",
|
||
" <td>0.716103</td>\n",
|
||
" <td>0.590690</td>\n",
|
||
" <td>0.796710</td>\n",
|
||
" <td>185.060622</td>\n",
|
||
" <td>13.017663</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>0.447013</td>\n",
|
||
" <td>0.845567</td>\n",
|
||
" <td>0.618526</td>\n",
|
||
" <td>0.790150</td>\n",
|
||
" <td>185.004740</td>\n",
|
||
" <td>12.973144</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>0.322255</td>\n",
|
||
" <td>0.888117</td>\n",
|
||
" <td>0.436471</td>\n",
|
||
" <td>0.852321</td>\n",
|
||
" <td>185.068499</td>\n",
|
||
" <td>12.956863</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>0.242587</td>\n",
|
||
" <td>0.915120</td>\n",
|
||
" <td>0.436207</td>\n",
|
||
" <td>0.858946</td>\n",
|
||
" <td>184.995601</td>\n",
|
||
" <td>12.969341</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>0.179439</td>\n",
|
||
" <td>0.937612</td>\n",
|
||
" <td>0.479547</td>\n",
|
||
" <td>0.854727</td>\n",
|
||
" <td>184.995575</td>\n",
|
||
" <td>12.993280</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" train_loss train_acc test_loss test_acc train_epoch_time \\\n",
|
||
"0 0.815352 0.716103 0.590690 0.796710 185.060622 \n",
|
||
"1 0.447013 0.845567 0.618526 0.790150 185.004740 \n",
|
||
"2 0.322255 0.888117 0.436471 0.852321 185.068499 \n",
|
||
"3 0.242587 0.915120 0.436207 0.858946 184.995601 \n",
|
||
"4 0.179439 0.937612 0.479547 0.854727 184.995575 \n",
|
||
"\n",
|
||
" test_epoch_time \n",
|
||
"0 13.017663 \n",
|
||
"1 12.973144 \n",
|
||
"2 12.956863 \n",
|
||
"3 12.969341 \n",
|
||
"4 12.993280 "
|
||
]
|
||
},
|
||
"execution_count": 30,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Go through non_compile_results_multiple_runs and create a dataframe for each run then concatenate them together\n",
|
||
"non_compile_results_dfs = []\n",
|
||
"for result in non_compile_results_multiple_runs:\n",
|
||
" result_df = pd.DataFrame(result)\n",
|
||
" non_compile_results_dfs.append(result_df)\n",
|
||
"non_compile_results_multiple_runs_df = pd.concat(non_compile_results_dfs)\n",
|
||
"\n",
|
||
"# Get the averages across the multiple runs\n",
|
||
"non_compile_results_multiple_runs_df = non_compile_results_multiple_runs_df.groupby(non_compile_results_multiple_runs_df.index).mean()\n",
|
||
"non_compile_results_multiple_runs_df"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Wonderful!\n",
|
||
"\n",
|
||
"We can inspect these later, let's move onto experiment 4."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 4.2 Experiment 4 - Multiple runs, with compile\n",
|
||
"\n",
|
||
"Time for experiment 4.\n",
|
||
"\n",
|
||
"Running a compiled model for multiple runs.\n",
|
||
"\n",
|
||
"| **Experiment** | **Model** | **Data** | **Epochs** | **Batch size** | **Image size** | **`torch.compile()`** | \n",
|
||
"|----- |-----| -----| -----| -----| -----| -----|\n",
|
||
"| 4 (multi-run) | ResNet50 | CIFAR10 | 3x5 | 128 | 224 | Yes |\n",
|
||
"\n",
|
||
"We can do this by using the `create_compiled_model()` and `train_compiled_model()` functions we created earlier.\n",
|
||
"\n",
|
||
"We'll start by creating the compiled model *first* and then training it for 3 runs.\n",
|
||
"\n",
|
||
"We're not worried about the results of the model (loss and accuracy) as much as how long it takes.\n",
|
||
"\n",
|
||
"The reason why we compile it once at the start is that PyTorch only needs to run the optimization steps once (this can take some time) and then it can reuse them for the rest of the runs.\n",
|
||
"\n",
|
||
"We'll also create an empty list just like before to store our model's results over a series of runs. \n",
|
||
"\n",
|
||
"> **Note:** Running the following code can take quite a while depending on the speed of your GPU, for me, it took 18 minutes on a NVIDIA A100 on Google Colab Pro and around 45 minutes on a NVIDIA TITAN RTX."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 31,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Time to compile: 0.001275777816772461 | Note: The first time you compile your model, the first few epochs will be slower than subsequent runs.\n"
|
||
]
|
||
},
|
||
{
|
||
"data": {
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"model_id": "f3338920367645c1b013ba2882dfc2d8",
|
||
"version_major": 2,
|
||
"version_minor": 0
|
||
},
|
||
"text/plain": [
|
||
" 0%| | 0/3 [00:00<?, ?it/s]"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"output_type": "display_data"
|
||
},
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Run 1 of 3 for compiled model\n",
|
||
"Epoch: 1 | train_loss: 0.8026 | train_acc: 0.7192 | test_loss: 0.6995 | test_acc: 0.7650 | train_epoch_time: 194.3336 | test_epoch_time: 20.6106\n",
|
||
"Epoch: 2 | train_loss: 0.4440 | train_acc: 0.8483 | test_loss: 0.5565 | test_acc: 0.8089 | train_epoch_time: 169.3882 | test_epoch_time: 10.8076\n",
|
||
"Epoch: 3 | train_loss: 0.3208 | train_acc: 0.8896 | test_loss: 0.4164 | test_acc: 0.8620 | train_epoch_time: 169.9283 | test_epoch_time: 10.8361\n",
|
||
"Epoch: 4 | train_loss: 0.2329 | train_acc: 0.9197 | test_loss: 0.3635 | test_acc: 0.8792 | train_epoch_time: 169.8744 | test_epoch_time: 10.9050\n",
|
||
"Epoch: 5 | train_loss: 0.1803 | train_acc: 0.9369 | test_loss: 0.4387 | test_acc: 0.8587 | train_epoch_time: 169.6391 | test_epoch_time: 10.8240\n",
|
||
"[INFO] Run 2 of 3 for compiled model\n",
|
||
"Epoch: 1 | train_loss: 0.1875 | train_acc: 0.9347 | test_loss: 0.4187 | test_acc: 0.8714 | train_epoch_time: 169.4814 | test_epoch_time: 10.8180\n",
|
||
"Epoch: 2 | train_loss: 0.1288 | train_acc: 0.9550 | test_loss: 0.4333 | test_acc: 0.8698 | train_epoch_time: 169.4503 | test_epoch_time: 10.8263\n",
|
||
"Epoch: 3 | train_loss: 0.0950 | train_acc: 0.9672 | test_loss: 0.4867 | test_acc: 0.8650 | train_epoch_time: 169.6038 | test_epoch_time: 10.8199\n",
|
||
"Epoch: 4 | train_loss: 0.0943 | train_acc: 0.9675 | test_loss: 0.3714 | test_acc: 0.8966 | train_epoch_time: 169.5757 | test_epoch_time: 10.8221\n",
|
||
"Epoch: 5 | train_loss: 0.0537 | train_acc: 0.9821 | test_loss: 0.5002 | test_acc: 0.8701 | train_epoch_time: 169.5253 | test_epoch_time: 10.8426\n",
|
||
"[INFO] Run 3 of 3 for compiled model\n",
|
||
"Epoch: 1 | train_loss: 0.0705 | train_acc: 0.9751 | test_loss: 0.4333 | test_acc: 0.8839 | train_epoch_time: 169.4846 | test_epoch_time: 10.9057\n",
|
||
"Epoch: 2 | train_loss: 0.0595 | train_acc: 0.9802 | test_loss: 0.4341 | test_acc: 0.8904 | train_epoch_time: 169.6055 | test_epoch_time: 10.8804\n",
|
||
"Epoch: 3 | train_loss: 0.0405 | train_acc: 0.9859 | test_loss: 0.4478 | test_acc: 0.8901 | train_epoch_time: 169.5788 | test_epoch_time: 10.8449\n",
|
||
"Epoch: 4 | train_loss: 0.0365 | train_acc: 0.9873 | test_loss: 0.5382 | test_acc: 0.8765 | train_epoch_time: 169.6732 | test_epoch_time: 10.9873\n",
|
||
"Epoch: 5 | train_loss: 0.0422 | train_acc: 0.9854 | test_loss: 0.5057 | test_acc: 0.8832 | train_epoch_time: 169.6618 | test_epoch_time: 10.8969\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create compiled model\n",
|
||
"compiled_model = create_compiled_model()\n",
|
||
"\n",
|
||
"# Create an empty list to store compiled model results\n",
|
||
"compiled_results_multiple_runs = []\n",
|
||
"\n",
|
||
"# Run compiled model for multiple runs\n",
|
||
"for i in tqdm(range(NUM_RUNS)):\n",
|
||
" print(f\"[INFO] Run {i+1} of {NUM_RUNS} for compiled model\")\n",
|
||
" # Train the compiled model (note: the model will only be compiled once and then re-used for subsequent runs)\n",
|
||
" results = train_compiled_model(model=compiled_model, epochs=NUM_EPOCHS, disable_progress_bar=True)\n",
|
||
" compiled_results_multiple_runs.append(results)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Experiment 4 done!\n",
|
||
"\n",
|
||
"Now let's put the results together into a dataframe and take the mean across each of the runs (we'll do this by grouping by the epoch number, which is the index number of the dataframe)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 32,
|
||
"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>train_loss</th>\n",
|
||
" <th>train_acc</th>\n",
|
||
" <th>test_loss</th>\n",
|
||
" <th>test_acc</th>\n",
|
||
" <th>train_epoch_time</th>\n",
|
||
" <th>test_epoch_time</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>0.353548</td>\n",
|
||
" <td>0.876332</td>\n",
|
||
" <td>0.517181</td>\n",
|
||
" <td>0.840124</td>\n",
|
||
" <td>177.766548</td>\n",
|
||
" <td>14.111428</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>0.210781</td>\n",
|
||
" <td>0.927845</td>\n",
|
||
" <td>0.474630</td>\n",
|
||
" <td>0.856375</td>\n",
|
||
" <td>169.481367</td>\n",
|
||
" <td>10.838063</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>0.152098</td>\n",
|
||
" <td>0.947577</td>\n",
|
||
" <td>0.450293</td>\n",
|
||
" <td>0.872396</td>\n",
|
||
" <td>169.703638</td>\n",
|
||
" <td>10.833619</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>0.121230</td>\n",
|
||
" <td>0.958177</td>\n",
|
||
" <td>0.424376</td>\n",
|
||
" <td>0.884065</td>\n",
|
||
" <td>169.707751</td>\n",
|
||
" <td>10.904810</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>0.092080</td>\n",
|
||
" <td>0.968116</td>\n",
|
||
" <td>0.481520</td>\n",
|
||
" <td>0.870649</td>\n",
|
||
" <td>169.608708</td>\n",
|
||
" <td>10.854486</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" train_loss train_acc test_loss test_acc train_epoch_time \\\n",
|
||
"0 0.353548 0.876332 0.517181 0.840124 177.766548 \n",
|
||
"1 0.210781 0.927845 0.474630 0.856375 169.481367 \n",
|
||
"2 0.152098 0.947577 0.450293 0.872396 169.703638 \n",
|
||
"3 0.121230 0.958177 0.424376 0.884065 169.707751 \n",
|
||
"4 0.092080 0.968116 0.481520 0.870649 169.608708 \n",
|
||
"\n",
|
||
" test_epoch_time \n",
|
||
"0 14.111428 \n",
|
||
"1 10.838063 \n",
|
||
"2 10.833619 \n",
|
||
"3 10.904810 \n",
|
||
"4 10.854486 "
|
||
]
|
||
},
|
||
"execution_count": 32,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Go through compile_results_multiple_runs and create a dataframe for each run then concatenate them together\n",
|
||
"compile_results_dfs = []\n",
|
||
"for result in compiled_results_multiple_runs:\n",
|
||
" result_df = pd.DataFrame(result)\n",
|
||
" compile_results_dfs.append(result_df)\n",
|
||
"compile_results_multiple_runs_df = pd.concat(compile_results_dfs)\n",
|
||
"\n",
|
||
"# Get the averages across the multiple runs\n",
|
||
"compile_results_multiple_runs_df = compile_results_multiple_runs_df.groupby(compile_results_multiple_runs_df.index).mean() # .index = groupby the epoch number\n",
|
||
"compile_results_multiple_runs_df"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"### 4.3 Compare results of experiment 3 and 4\n",
|
||
"\n",
|
||
"Multi-run experiments done!\n",
|
||
"\n",
|
||
"Let's inspect the results.\n",
|
||
"\n",
|
||
"We can do so with our `plot_mean_epoch_times()` function we created before.\n",
|
||
"\n",
|
||
"This time we'll set the `multi_runs` parameter to `True` so that our plots reflect the fact we're plotting the results of multiple runs.\n",
|
||
"\n",
|
||
"We'll make sure we've got a directory to save the figure to as well. "
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 33,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Mean train epoch time difference: -7.443% (negative means faster)\n",
|
||
"Mean test epoch time difference: -11.351% (negative means faster)\n",
|
||
"[INFO] Plot saved to pytorch_2_results/figures/multi_run_NVIDIA_TITAN_RTX_ResNet50_CIFAR10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YYQdeeuklAM455xzWXnttBgwYwL777gvM3Fq8zjrrMHbs2BnKP+mkk7jrrrsYOHAgZ511FmPGjGHjjTdm4MCBDBgwgCeffLLN+NQ2E11JkuZTTz75JEcffTRjxoxhqaWW4uqrr+aggw7ixz/+MQ899BDrrrsup5122vTpp06dyn333ccvfvGLGYY3d9555/Hss8/ywAMP8NBDDzFkyBAmT57M0KFDufLKK3n44YeZOnUqv/nNb6bPs9JKK3HPPfew5ZZbMnToUK666iruvfdeTj311OnT3HffffzsZz/j4Ycf5umnn+aaa65pNYabb76ZJ598kvvuu4/Ro0czatQo7rzzTkaNGsUVV1zBAw88wDXXXMO///3vdrfTxIkTueOOOzj22GP52te+xlVXXcWoUaM49NBD+fa3vw3AGWecMX19m5LzjjjjjDPYcsstGT16NCeccALDhw/nuOOOY/To0YwcOZIVV1yxw2VpZt6MJknSfKpv374MHDgQgA033JCnn36aiRMnsvXWWwNw8MEHs/fee0+ffo899pg+bfOWyUa33HILRx11FAstVKQZyyyzDA8++CB9+/alX79+08s+99xzOf744wHYddddAVh33XV5++236dWrF7169aJnz57T+99uvPHGrLrqqgDst99+3H333ey1114txnDzzTdz8803s/766wPw9ttv8+STTzJp0iR23313FltssRmW25Z99tkHgCeeeIJHHnmE7bbbDiharj/1qU8BMGDAAIYMGcIXv/hFvvjFL7ZbZms23XRTTj/9dMaNG8cee+zB6quvPstlyRZdSZLmW4ssssj01wsuuOD0hLK96RdccME2+6tm5kzPe83MDpW9wAILzBDXAgssMH1Zzcts65mymcnJJ5/M6NGjGT16NE899RRf/vKX252vJYsvvvj0Mvv37z+9zIcffpibb74ZgBtuuIGjjz6aUaNGseGGGzJ16lQWWmih6d0rgA790MP+++/Pddddx6KLLsoOO+zAbbfd1qlYNSNbdCVJqtjc8jiwJZdckqWXXpq77rqLLbfckt/97nfTW3c7Y/vtt2f48OEMHjyYhRZaiNdff50111yTsWPH8tRTT/HpT396lsq+7777ePbZZ1lllVW48sorOeKII1qddocdduC73/0uQ4YMYYklluCFF16gR48ebLXVVgwdOpSTTjqJqVOncv3113PkkUd2aPlrrLEG48eP55577mHTTTflgw8+4D//+Q9rrbUWzz//PJ/97GfZYostuOyyy3j77bfp06cPf/nLXwC4//77efbZZ2cqs1evXkyaNGn6+2eeeYZVV12VY489lmeeeYaHHnqIz33uc53aTvqIiW7FuvvZieq4ueXEIklzk4svvpijjjqKd999l1VXXZULL7yw02Ucdthh/Oc//2HAgAH06NGDww8/nGOOOYYLL7yQvffem6lTp7LRRhtx1FFHdarcTTfdlJNOOomHH354+o1prdl+++157LHH2HTTTYHicV6///3v2WCDDdhnn30YOHAgq6yyCltuuWWHl7/wwgtz1VVXceyxx/Lmm28ydepUjj/+ePr168cBBxzAm2++SWZywgknsNRSS7HnnntyySWXMHDgQDbaaKPp3TYaDRgwgIUWWoj11luPoUOHMnnyZH7/+9/To0cPPvnJT87QR1mdF+1dSphfDRo0KEeOHDnbl2OiWx0TXUlVeeyxx1hrrbWqDmOeMmLECM4888zpLaTzs5b2n4gYlZmDKgpprmUfXUmSJNWSXRckSdIs+dvf/saJJ544w7C+ffty7bXXdvuyBg8ezODBg7u93CZHH300//jHP2YYdtxxx3HIIYfMtmVq9jPRlSRJs2SHHXZghx12qDqMbnHuuedWHYJmA7suSJIkqZZMdCVJklRLJrqSJEmqJfvoSpJUtWFLdnN5b3ZveV106qmnstVWW7HtttsyePBgzjzzTAYN6tiTsKp6rFhjnD/84Q855ZRT5ujy1T1s0ZUkSbPV97//fbbddtvZvpy2fpa4K374wx/OlnI1+5noSpI0n7rkkksYMGAA6623HgceeCDPPfcc22yzDQMGDGCbbbbhv//9LwBDhw7lK1/5Cp/97GdZddVVueOOOzj00ENZa621GDp06PTyllhiCb7xjW+wwQYbsM022zB+/Pjp81911VUzLf/mm29m0003ZYMNNmDvvffm7bffBuCmm25izTXXZIsttuCaa65pcx2GDRvGEUccwfbbb89BBx3E+PHj2XPPPdloo43YaKONpj8y7I477mDgwIEMHDiQ9ddfn0mTJjFixAh23nnn6WUdc8wxXHTRRTOUf9JJJ/Hee+8xcOBAhgwZwjvvvMNOO+3EeuutxzrrrMOVV17Z6e2uOcdEV5Kk+dCYMWM4/fTTue2223jwwQc5++yzOeaYYzjooIN46KGHGDJkCMcee+z06d944w1uu+02zjrrLHbZZRdOOOEExowZw8MPP8zo0aMBeOedd9hggw24//772XrrrTnttNNaXf5rr73GD37wA2655Rbuv/9+Bg0axM9//nMmT57M4YcfzvXXX89dd93Fyy+/3O66jBo1ij//+c9cdtllHHfccZxwwgn8+9//5uqrr+awww4D4Mwzz+Tcc89l9OjR3HXXXSy66KId2k5nnHEGiy66KKNHj+bSSy/lpptuYvnll+fBBx/kkUce4fOf/3yHylE1THQlSZoP3Xbbbey1114st9xyACyzzDLcc8897L///gAceOCB3H333dOn32WXXYgI1l13XT7xiU+w7rrrssACC9C/f3/Gjh0LwAILLMA+++wDwAEHHDDD/M3de++9PProo2y++eYMHDiQiy++mOeee47HH3+cvn37svrqqxMRHHDAAe2uy6677jo9cb3llls45phjGDhwILvuuitvvfUWkyZNYvPNN+frX/8655xzDhMnTmShhWbtNqV1112XW265hRNPPJG77rqLJZfs5v7V6lbejCZJ0nwoM4mINqdpHL/IIosARTLb9LrpfWt9Y9sqPzPZbrvtuPzyy2cYPnr06Hbjam7xxRef/vrDDz/knnvumanF9qSTTmKnnXbixhtvZJNNNuGWW25hoYUW4sMPP5w+zeTJk9tdVr9+/Rg1ahQ33ngjJ598Mttvvz2nnnpqp+LVnGOLriRJ86FtttmGP/zhD0yYMAGA119/nc0224wrrrgCgEsvvZQtttiiU2V++OGH0/viXnbZZW3Ov8kmm/CPf/yDp556CoB3332X//znP6y55po8++yzPP300wAzJcLt2X777fnVr341/X1Tt4qnn36addddlxNPPJFBgwbx+OOPs8oqq/Doo48yZcoU3nzzTW699dYWy+zRowcffPABAC+++CKLLbYYBxxwAN/85je5//77OxWf5ixbdCVJqloFjwPr378/3/72t9l6661ZcMEFWX/99TnnnHM49NBD+elPf0rv3r258MILO1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57Yj4CXA48IOubAhJ84UAfgnslpnjI2If4HTgUOAkoG9mTomIpTJzYkQMp+1W4H0iYouG95uW/zcG1gaeA24C9oiIfwI/BjYE3gBujogvAv8Azqeof5+NiGUayutofStVwkRXc7s/ZmZTMrokcHFErE7x8809WpnnhsycAkyJiFeBT1D8Ml5zrXVduBwgM++MiI9FxFLAFpRJdWbeFhHLRsSSwLYUPz5COe6N8uX7wF/K16OA7Tq0tpLmd4tQfLn+e0RA8dz3l8pxDwGXRsSfgD91sLyZui6U5d6Xmc+U7y+nqOM+AEZk5vhy+KXAVhT9hu/MzGcBMvP1huI6Wt9KlTDR1dzunYbX/wvcnpm7l5fsRrQyz5SG19Po/H7e/Jl7SdHK0tJ00cL0AB/kR8/um5UYJM2fAhiTmZu2MG4nisRzV+C7EdG/C8vpaD3XFFNrzyLtan0rzVb20dW8ZEk+unt46Gxczj4A5eW+NzPzTeBOYEg5fDDwWma+BdwMTG8taei6IEmzYgrQOyI2BYiIHhHRv+xDu1Jm3g78D7AUsATF02N6zcJyNo6IvmW5+wB3A/8Cto6I5SJiQWA/4A7gnnJ43zKmZVorVJrbmOhqXvIT4EcR8Q+Ky3lddXt5A8foiLikYfgbZV+14cCXy2HDgEER8RBwBnBwOfwHwNLljRsPUvRVk6RZ9SGwF8UNuA8Co4HNKOq830fEw8ADwFmZORG4Hti9jZvR9mmo50ZHxGbl8Hso6rJHgGeBazPzJeBk4HbgQeD+zPxz2ZXhCOCaMqYrZ8uaS7OBv4wmNYiIEcA3y0eWSVLtlFelvpmZO1ccijTb2aIrSZKkWrJFV5IkSbVki64kSZJqyURXkiRJtWSiK0mSpFoy0ZUkSVItmehKkiSplkx0JUmSVEv/H5PyfAcOfleQAAAAAElFTkSuQmCC",
|
||
"text/plain": [
|
||
"<Figure size 720x504 with 1 Axes>"
|
||
]
|
||
},
|
||
"metadata": {
|
||
"needs_background": "light"
|
||
},
|
||
"output_type": "display_data"
|
||
}
|
||
],
|
||
"source": [
|
||
"# Create a directory to save the multi-run figure to \n",
|
||
"os.makedirs(\"pytorch_2_results/figures\", exist_ok=True)\n",
|
||
"\n",
|
||
"# Create a path to save the figure for multiple runs\n",
|
||
"save_path_multi_run = f\"pytorch_2_results/figures/multi_run_{GPU_NAME}_{MODEL_NAME}_{DATASET_NAME}_{IMAGE_SIZE}_train_epoch_time.png\"\n",
|
||
"\n",
|
||
"# Plot the mean epoch times for experiment 3 and 4\n",
|
||
"plot_mean_epoch_times(non_compiled_results=non_compile_results_multiple_runs_df, \n",
|
||
" compiled_results=compile_results_multiple_runs_df, \n",
|
||
" multi_runs=True, \n",
|
||
" num_runs=NUM_RUNS, \n",
|
||
" save_path=save_path_multi_run, \n",
|
||
" save=True)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Nice! \n",
|
||
"\n",
|
||
"Looks like the compiled model edges out the non-compiled model across multiple runs.\n",
|
||
"\n",
|
||
"This is likely because on a single run (with a low amount of epochs), the compiling of the model takes quite a bit of time for the first epoch to run.\n",
|
||
"\n",
|
||
"However, when the model has already been compiled and starts training for longer, the speedups from the behind the scenes optimizations start to show.\n",
|
||
"\n",
|
||
"A possible extension would be to let the model train for a longer time, say 100 epochs, and see how the results compare."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"\n",
|
||
"### 4.4 Save multi run results to file with GPU details\n",
|
||
"\n",
|
||
"Let's also save our results dataframes for experiments 3 and 4 to file in case we'd like to inspect them later or compare them to other kinds of models."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 34,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"[INFO] Saving experiment 3 non-compiled results to: pytorch_2_results/multi_run_results/single_run_non_compiled_results_CIFAR10_ResNet50_NVIDIA_TITAN_RTX.csv\n",
|
||
"[INFO] Saving experiment 4 compiled results to: pytorch_2_results/multi_run_results/single_run_compiled_results_CIFAR10_ResNet50_NVIDIA_TITAN_RTX.csv\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"# Make a directory for multi_run results\n",
|
||
"import os\n",
|
||
"pytorch_2_results_dir = \"pytorch_2_results\"\n",
|
||
"pytorch_2_multi_run_results_dir = f\"{pytorch_2_results_dir}/multi_run_results\"\n",
|
||
"os.makedirs(pytorch_2_multi_run_results_dir, exist_ok=True)\n",
|
||
"\n",
|
||
"# Create filenames for each of the dataframes\n",
|
||
"save_name_for_multi_run_non_compiled_results = f\"multi_run_non_compiled_results_{NUM_RUNS}_runs_{DATASET_NAME}_{MODEL_NAME}_{GPU_NAME}.csv\"\n",
|
||
"save_name_for_multi_run_compiled_results = f\"multi_run_compiled_results_{NUM_RUNS}_runs_{DATASET_NAME}_{MODEL_NAME}_{GPU_NAME}.csv\"\n",
|
||
"\n",
|
||
"# Create filepaths to save the results to\n",
|
||
"multi_run_no_compile_save_path = f\"{pytorch_2_multi_run_results_dir}/{save_name_for_non_compiled_results}\"\n",
|
||
"multi_run_compile_save_path = f\"{pytorch_2_multi_run_results_dir}/{save_name_for_compiled_results}\"\n",
|
||
"print(f\"[INFO] Saving experiment 3 non-compiled results to: {multi_run_no_compile_save_path}\")\n",
|
||
"print(f\"[INFO] Saving experiment 4 compiled results to: {multi_run_compile_save_path}\")\n",
|
||
"\n",
|
||
"# Save the results\n",
|
||
"non_compile_results_multiple_runs_df.to_csv(multi_run_no_compile_save_path)\n",
|
||
"compile_results_multiple_runs_df.to_csv(multi_run_compile_save_path)"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 5. Possible improvements and extensions\n",
|
||
"\n",
|
||
"We've explored the fundamentals of `torch.compile()` and wrote code for several experiments to test how it performs.\n",
|
||
"\n",
|
||
"But there's still more we could do.\n",
|
||
"\n",
|
||
"As we've discussed, many of the speedups in PyTorch 2.0 and `torch.compile()` come from using newer GPUs (e.g. A100 and above) and using as much of the GPU as possible (larger batch sizes, larger model sizes).\n",
|
||
"\n",
|
||
"For even more speedups, I'd recommend researching/trying the following:\n",
|
||
"\n",
|
||
"* **More powerful CPUs** - I have a sneaking suspicion that Google Colab instances are limited to 2 CPU cores, speedup numbers could be improved with more CPUs. This could be tracked via the [PyTorch Profiler](https://pytorch.org/tutorials/recipes/recipes/profiler_recipe.html) (a tool to find what processes take what time).\n",
|
||
"* **Using mixed precision training** - newer GPUs have the ability to handle different precision types (e.g. [`torch.float16`](https://pytorch.org/docs/stable/tensors.html#data-types) and [`torch.bfloat16`](https://pytorch.org/docs/stable/generated/torch.Tensor.bfloat16.html)) which enable faster training and inference. I'd suspect you'll see an even larger speedup than we've seen here by using mixed precision training. For more on this, see the [PyTorch documentation for automatic mixed precision](https://pytorch.org/docs/stable/notes/amp_examples.html#amp-examples) (also called AMP) with PyTorch. \n",
|
||
"* **Transformer based models may see more *relative* speedups than convolutional models** - PyTorch 2.0 includes a [stable release for accelerated transformer models](https://pytorch.org/blog/pytorch-2.0-release/#stable-accelerated-pytorch-2-transformers) (models which use the attention mechanism). The main speedups come from an improved implementation of [`scaled_dot_product_attention()`](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html?highlight=scaled_dot_product#torch.nn.functional.scaled_dot_product_attention) which automatically selects the best version of attention to use based on the hardware you're computing on. You can see more in the [dedicated PyTorch tutorial](https://pytorch.org/tutorials/intermediate/scaled_dot_product_attention_tutorial.html). \n",
|
||
"* **Train for longer** - As previously discussed, the speedups from `torch.compile()` are likely to be more noticeable when training for longer. A great exercise would be to train over a longer number of epochs, potentially on a different dataset with a different model (e.g. a transformer) and see how the speedups compare."
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## 6. Resources to learn more\n",
|
||
"\n",
|
||
"I've found the following resources to be helpful learning about PyTorch 2.0 and it's upcoming features.\n",
|
||
"\n",
|
||
"* [PyTorch 2.0 launch blog post](https://pytorch.org/get-started/pytorch-2.0/). \n",
|
||
"* [PyTorch 2.0 release notes](https://pytorch.org/blog/pytorch-2.0-release/) (blog post).\n",
|
||
" * As well as the [GitHub release notes](https://github.com/pytorch/pytorch/releases/tag/v2.0.0) (lots of info here!).\n",
|
||
"* [PyTorch default device context manager docs](https://github.com/pytorch/tutorials/pull/2220/files).\n",
|
||
"* [PyTorch 2.0 video introduction on YouTube](https://youtu.be/WqLKfta5Ijw) (created by yours truly).\n",
|
||
"* See a [tip by Sebastian Raschka](https://twitter.com/rasbt/status/1638297626385719297?s=20) to improve `torch.compile()` by performing an example batch first (warm-up the model) before continuing with further training (this explains the increased speedups with multiple runs)."
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "Python 3",
|
||
"language": "python",
|
||
"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.10.4"
|
||
},
|
||
"orig_nbformat": 4,
|
||
"vscode": {
|
||
"interpreter": {
|
||
"hash": "03bc13acfc4e8139fb32f411c6712485d4605f3bdd6569f6973c62d6adcc8291"
|
||
}
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 2
|
||
}
|