PyTorch & CUDA Setup - Windows 10

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this webcast i'm going to show you how to set up an environment using pytorch and cuda so on the pi touch homepage i'm going to click getting started and they've made it really easy to set up in a python environment so what we need to select is the build that we're going to use we can either use the latest stable one which is 1.0 or we can go for the lts which stands for long term support which is 1.8.2 so i'll select that i'm on the windows operating system i'm going to be using pip for the installation and i'm going to be using cuda 11.1 so before we install we need to check if our gpu can support cuda so for google for cuda compatible gpu we get a link to developer.nvidia.com and here we can see the gpu compatibility so i'm running here on an nvidia geforce rtx 3090 so if i click on the link for geforce and titan products you can see that the 3090 is supported so it should be fine installing cuda 11. so if your gpu isn't listed as being cuda supported you have the option of installing pi torch using the cpu you'll still be able to learn a bit about pi torch and train some neural networks however you'll find that when you're looking at more complex networks working with custom vision and especially working with transfer learning that the performance is not going to be great you can however look at leveraging cloud-based services such as azole machine learning and i'll show you how i can do that in some of my other webcasts now we also need to make sure that cuda is installed i don't have it installed on this machine so now browse to cuda install and go to the downloads and select windows so i'm currently running running windows 10 so i'm going to select for the network install which will be a smaller install and it will download the components from the network as i run the install okay so i'm going to extract the package i can accept the licensing agreement if we go into the customs section we'll see all the components that can be going to be installed and i'll select everything and click next so saying here that i've got visual studio running i'm going to shut down visual studio i can then retry that and it's running through the install this will take a few minutes i'll pause the recording whilst this installation runs the installation is finished so i can close that window so the next thing we need to do is to run this command in pip in a python environment so to do that in visual studio 22 i'm going to go file new project i'm going to select python application and click next i'll call a project pytorch test and create that project we can see here that we're using the global default python environment now i'd like to create a separate python environment for installing pytorch and the reason is i may want to install different versions and i don't want to create one for each specific project because they can take up a lot of space on the hard drive so on my c drive i've created a folder called python environments where i can generate these environments i can share between different projects so here i'm going to add an environment i'll give it the name of torch m and i want to make this environment available globally so i can use it in different projects i'll just drop that in as a description we don't really need anything more i'm going to select python 3.9 as the environment type and for the environment location i'm going to select the python environments folder and click create so you can see that we've got torch m created at that location and it's currently quite small 13.3 meg but the size will increase greatly when i install the pytox components so what i need is a command prompt at this particular environment so i can run the pip command to install so if i type pip you can see that we've got pip installed there and i think this install is actually using pip3 but we can see that the command is running so i can draw back here and i can copy this command here which is going to be the command line to store install all of the components so let's copy this drop back to the command prompt and run that command so it's going to take a while to install i'll speed up the video as the install is running so you don't have to sit through all of this so we can see that the install was successful it's giving me the option to upgrade pip which i can do if i just copy this command in this should do that okay so we've got the new version of pip installed and if i type pip list you can see that we've got numpy pillow and the various torch components torch torch audio and torch vision and they're running with the cuda 11.1 versions there you can see that the pytorch environment is now 5.54 gigabytes this is pretty large and this is the reason why i'd like to share this environment between many different projects when i'm working with pytorch but i don't want to install pytorch on the single global environment because i may want to use different versions and also have the option to create additional environments if i'm working with keras and tensorflow and so on and it's generally much better to use these shared environments rather than just trying to install everything in the global environment because you could get problems with versioning differences on the various packages so back to visual studio let's just test if we can access the gpu so googling on to stack overflow there's a quick check to see if pi torch is using the gpu so what i'm going to do is just copy this code here bang it into my python file we don't need these lines here we should just be able to run these and and i'm just going to print out these with these results here we've got some squiggly lines things saying that the torch could not be resolved but that's just because we've only just installed it now and that should correct itself so let's just see if this is going to run and we can see that cuda is available it's the device zero we've got the device object there you can see there's one device and it's an nvidia geforce rtx 3090. so i can now start programming and leveraging that gpu from within pi torch
Info
Channel: CloudCasts - Alan Smith
Views: 63,629
Rating: undefined out of 5
Keywords: Artificial Intellegence, Machine Learning, Deep Learning, Python, CUDA, PyTorch
Id: GMSjDTU8Zlc
Channel Id: undefined
Length: 6min 35sec (395 seconds)
Published: Fri Nov 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.