AI-powered search & chat for Data / Computer Science Students
(beta) Compiling the optimizer with torch.compile
(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
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 TutorialsDCGAN Tutorial
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 TutorialsAdversarial Example Generation
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 TutorialsTransfer Learning for Computer Vision Tutorial
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 TutorialsTorchVision Object Detection Finetuning Tutorial
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 TutorialsVisualizing Models, Data, and Training with TensorBoard
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 TutorialsWhat is
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 TutorialsIntel® Extension for PyTorch* Backend
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 TutorialsPerformance Tuning Guide
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 TutorialsModel Understanding with Captum
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 TutorialsAutomatic Mixed Precision
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 TutorialsTraining with PyTorch
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 TutorialsDynamic Quantization
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 TutorialsHow to use TensorBoard with PyTorch
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 TutorialsModel Interpretability using Captum
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 TutorialsPyTorch Profiler
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 TutorialsZeroing out gradients in PyTorch
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 TutorialsSaving and loading models across devices in PyTorch
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 TutorialsWarmstarting model using parameters from a different model in PyTorch
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 TutorialsSaving and loading multiple models in one file using PyTorch
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 TutorialsSaving and loading a general checkpoint in PyTorch
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 TutorialsSaving and loading models for inference in PyTorch
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 TutorialsWhat is a state_dict in PyTorch
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- «
- ‹
- …