9 – PyTorch V2 Part 3 Solution V2

Hi and welcome back. Here’s my solution for this model that uses a LogSoftmax output. It is a pretty similar to what I built before with an index sequential. So, we just use a linear transformation, ReLU, linear transformation, ReLU, another linear transformation for output and then we can pass this to our LogSoftmax module. … Read more

8 – PyTorch V2 Part 3 V1

Hello, everyone, and welcome back. So, in this video and in this notebook, I’ll be showing you how to actually train neural networks in PyTorch. So, previously, we saw how to define neural networks in PyTorch using the nn module, but now we’re going to see how we actually take one of these networks that … Read more

7 – PyTorch V2 Part 2 Solution 2 V1

Welcome back. Here is my solution for the softmax function. Here in the numerator, we know we want to take the exponential, so it’s pretty straight forward with torch.exp. So we’re going to use the exponential of x, which is our input tensor. In the denominator, we know we want to do something like, again … Read more

6 – PyTorch V2 Part 2 Solution V1

Here is my solution for this multi-layer neural network for classifying handwritten digits from the MNIST dataset. So, here I’ve defined our activation function like before, so, again this is the sigmoid function and here I’m flattening the images. So, remember how to reshape your tensors. So, here I’m using.view. So, I’m just grabbing the … Read more

5 – PyTorch V2 Part 2 V1

Hello everyone and welcome back. So, in this notebook and series of videos, I’m going to be showing you a more powerful way to build neural networks and PyTorch. So, in the last notebook, you saw how you can calculate the output for network using tensors and matrix multiplication. But PyTorch has this nice module, … Read more

4 – PyTorch V2 Part 1 Solution 3 V1

All right. So, here’s my solution for this exercise. So, here, I had you calculate the output of this multi-layer network using the weights and features that we’ve defined up here. So, it was really similar to what we did before with our single layer simple neural network. So, it’s basically just taking the features … Read more

3 – PyTorch V2 Part 1 Solution 2 V1

Welcome to my solution for this exercise. So, for here, I had you calculate the output of our network using matrix multiplication. So remember, we wanted to use matrix multiplication because it’s more efficient than doing these two separate operations of the multiplication and the sum. But to do the matrix multiplication, we actually needed … Read more

20 – PyTorch V2 Part 8 Solution V1

Hi everyone, here is my solution for the transfer learning exercise that I had to do. So, this one’s going to be a little different. I’m going to be typing it out as I do it so you can understand my that process is kind of the combination of everything you’ve learned in this lesson. … Read more

2 – PyTorch V2 Part 1 Solution V1

So now, this is my solution for this exercise on calculating the output of this small simple neural network. So, remember that what we want to do is multiply our features by our weights, so features times weights. So these tensors, they work basically the same as NumPy arrays, if you’ve used NumPy before. So, … Read more

19 – PyTorch – Part 8

Hello everyone, welcome back. So in this network, we will be using a pre-trained network to solve this challenging problem of creating a classifier for your cat and dog images. These pre-trained networks were trained on ImageNet which is a massive dataset of over one million labeled images from 1,000 different categories. These are available … Read more

18 – PyTorch V2 Part 7 Solution V1

Hello, and welcome back. So, here are my solutions for the exercises I had you do on loading image data. Here, I had you define some transforms and then load the actual dataset with image folder and then turn that into a data loader using this torch utils data loader class. So, here, I chose … Read more

17 – PyTorch – Part 7

In this video, I’ll be showing you how to load image data. This is really useful for what you’ll be doing in real projects. So previously, we used MNIST. Fashion-MNIST were just toy datasets for testing your networks, but you’ll be using full-size images like you’d get from smartphone cameras and your actual projects that … Read more

16 – Saving & Loading Models V1

Hello. In this video, I’m going to be talking about saving and loading PyTorch models. So far, you’ve seen how to train models and use them to make predictions. But a lot of times, you’ll want to train a model and then later come back to it and make predictions or even continue training it … Read more

15 – PyTorch V2 Part 5 Solution 2 V1

Hi. Here’s my solution for your building and training this network using dropout now. Just like I showed you before, we can define our dropout module as self.dropout and then nn.dropout to give it some drop probability. So, in this case, 20 percent, and then just adding it to our forward method now on each … Read more

14 – PyTorch V2 Part 5 Solution V1

Welcome back. So, here’s my solution for the validation pass. So, here, our model has been defined, our loss, and our optimizer, and all this stuff. I’ve set to 30 epochs so we can see like how this trains or how the training loss drops, and how the validation loss changes over time. The way … Read more

13 – PyTorch V2 Part 5 V1 (1)

Hey there. So now, we’re going to start talking about inference and validation. So, when you have your trained network, you typically want to use it for making predictions. This is called inference, it’s a term borrowed from statistics. However, neural networks have a tendency to perform too well on your training data and they … Read more

12 – PyTorch V2 Part 4 Solution V1

Again. So, in the last video, I hand you try out building your own neural network to classify this fashion in this dataset. Here is my solution like how I decided to build this. So first, building our network. So, here, I’m going to import our normal modules from PyTorch. So, nn and optim, so, … Read more

11 – PyTorch – Part 4

Welcome back. So, in this notebook, you’ll be building your own neural network to classify clothing images. So, like I talked about in the last video, MNIST is actually a fairly trivial dataset these days. It’s really easy to get really high accuracy with a neural network. So instead, you’re going to be using Fashion-MNIST, … Read more

10 – PyTorch V2 Part 3 Solution 2 V1

Hi again. So, here’s my solution for the train pass that I had you implement. So, here we’re just defining our model like normal and then our negative log-likelihood loss using stochastic gradient descent and pass in our parameters. Then, here is our training pass. So, for each image in labels in trainloader, we’re going … Read more

1 – PyTorch V2 Part 1 V1

Hello everyone and welcome to this lesson on deep learning with PyTorch. So, in this lesson I’m going to be showing you how we can build neural networks with pyTorch and train them. By working through all these notebooks I built, you’ll be writing the actual code yourself for building these networks. By the end … Read more