AI-powered search & chat for Data / Computer Science Students

(beta) Compiling the optimizer with torch.compile

 PyTorch Tutorials

(beta) Compiling the optimizer with torch.compile Author: Michael Lazos The optimizer is a key algorithm for training any deep learning model. Since it is responsible for updating every model paramete...

Read more at PyTorch Tutorials

(beta) Using TORCH_LOGS python API with torch.compile

 PyTorch Tutorials

Setup In this example, we’ll set up a simple Python function which performs an elementwise add and observe the compilation process with TORCH_LOGS Python API. Note There is also an environment variabl...

Read more at PyTorch Tutorials

DCGAN Tutorial

 PyTorch Tutorials

Introduction This tutorial will give an introduction to DCGANs through an example. We will train a generative adversarial network (GAN) to generate new celebrities after showing it pictures of many re...

Read more at PyTorch Tutorials

Adversarial Example Generation

 PyTorch Tutorials

Threat Model For context, there are many categories of adversarial attacks, each with a different goal and assumption of the attacker’s knowledge. However, in general the overarching goal is to add th...

Read more at PyTorch Tutorials

Transfer Learning for Computer Vision Tutorial

 PyTorch Tutorials

Load Data We will use torchvision and torch.utils.data packages for loading the data. The problem we’re going to solve today is to train a model to classify ants and bees . We have about 120 training ...

Read more at PyTorch Tutorials

TorchVision Object Detection Finetuning Tutorial

 PyTorch Tutorials

Defining the Dataset The reference scripts for training object detection, instance segmentation and person keypoint detection allows for easily supporting adding new custom datasets. The dataset shoul...

Read more at PyTorch Tutorials

Visualizing Models, Data, and Training with TensorBoard

 PyTorch Tutorials

Visualizing Models, Data, and Training with TensorBoard In the 60 Minute Blitz , we show you how to load in data, feed it through a model we define as a subclass of nn.Module , train this model on tra...

Read more at PyTorch Tutorials

What is

 PyTorch Tutorials

MNIST data setup We will use the classic MNIST dataset, which consists of black-and-white images of hand-drawn digits (between 0 and 9). We will use pathlib for dealing with paths (part of the Python ...

Read more at PyTorch Tutorials

Intel® Extension for PyTorch* Backend

 PyTorch Tutorials

Intel® Extension for PyTorch* Backend To work better with torch.compile , Intel® Extension for PyTorch* implements a backend ipex . It targets to improve hardware resource usage efficiency on Intel pl...

Read more at PyTorch Tutorials

Performance Tuning Guide

 PyTorch Tutorials

General optimizations Enable asynchronous data loading and augmentation torch.utils.data.DataLoader supports asynchronous data loading and data augmentation in separate worker subprocesses. The defaul...

Read more at PyTorch Tutorials

Model Understanding with Captum

 PyTorch Tutorials

Model Understanding with Captum Follow along with the video below or on youtube . Download the notebook and corresponding files here . Captum (“comprehension” in Latin) is an open source, extensible l...

Read more at PyTorch Tutorials

Automatic Mixed Precision

 PyTorch Tutorials

A simple network The following sequence of linear layers and ReLUs should show a speedup with mixed precision. batch_size , in_size , out_size , and num_layers are chosen to be large enough to saturat...

Read more at PyTorch Tutorials

Training with PyTorch

 PyTorch Tutorials

Training with PyTorch Follow along with the video below or on youtube . Introduction In past videos, we’ve discussed and demonstrated: Building models with the neural network layers and functions of t...

Read more at PyTorch Tutorials

Dynamic Quantization

 PyTorch Tutorials

Introduction There are a number of trade-offs that can be made when designing neural networks. During model development and training you can alter the number of layers and number of parameters in a re...

Read more at PyTorch Tutorials

How to use TensorBoard with PyTorch

 PyTorch Tutorials

Installation PyTorch should be installed to log models and metrics into TensorBoard log directory. The following command will install PyTorch 1.4+ via Anaconda (recommended): or pip Using TensorBoard ...

Read more at PyTorch Tutorials

Model Interpretability using Captum

 PyTorch Tutorials

Before you begin Make sure Captum is installed in your active Python environment. Captum is available both on GitHub, as a pip package, or as a conda package. For detailed instructions, consult the in...

Read more at PyTorch Tutorials

PyTorch Profiler

 PyTorch Tutorials

Introduction PyTorch includes a simple profiler API that is useful when user needs to determine the most expensive operators in the model. In this recipe, we will use a simple Resnet model to demonstr...

Read more at PyTorch Tutorials

Zeroing out gradients in PyTorch

 PyTorch Tutorials

Introduction When training your neural network, models are able to increase their accuracy through gradient descent. In short, gradient descent is the process of minimizing our loss (or error) by twea...

Read more at PyTorch Tutorials

Saving and loading models across devices in PyTorch

 PyTorch Tutorials

Introduction Saving and loading models across devices is relatively straightforward using PyTorch. In this recipe, we will experiment with saving and loading models across CPUs and GPUs. Setup In orde...

Read more at PyTorch Tutorials

Warmstarting model using parameters from a different model in PyTorch

 PyTorch Tutorials

Introduction Whether you are loading from a partial state_dict , which is missing some keys, or loading a state_dict with more keys than the model that you are loading into, you can set the strict arg...

Read more at PyTorch Tutorials

Saving and loading multiple models in one file using PyTorch

 PyTorch Tutorials

Introduction When saving a model comprised of multiple torch.nn.Modules , such as a GAN, a sequence-to-sequence model, or an ensemble of models, you must save a dictionary of each model’s state_dict a...

Read more at PyTorch Tutorials

Saving and loading a general checkpoint in PyTorch

 PyTorch Tutorials

Introduction To save multiple checkpoints, you must organize them in a dictionary and use torch.save() to serialize the dictionary. A common PyTorch convention is to save these checkpoints using the ....

Read more at PyTorch Tutorials

Saving and loading models for inference in PyTorch

 PyTorch Tutorials

Introduction Saving the model’s state_dict with the torch.save() function will give you the most flexibility for restoring the model later. This is the recommended method for saving models, because it...

Read more at PyTorch Tutorials

What is a state_dict in PyTorch

 PyTorch Tutorials

Introduction A state_dict is an integral entity if you are interested in saving or loading models from PyTorch. Because state_dict objects are Python dictionaries, they can be easily saved, updated, a...

Read more at PyTorch Tutorials