How to Install CUDA for PyTorch in 2023

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on guys welcome back to another video today I'm going to be showing you guys how to install Cuda for pi torch uh the installation process is relatively simple but before we start you do have to have a compatible GPU to run this so I'll leave a link to this in the description it's a list of all the Nvidia gpus it's updated whenever there's new ones if it's compatible go to this website I'll leave links to all of these websites in the description this is um Cuda download so just type in install Cuda first link included toolkit go through all this windows I have Windows 11. you could do the exe Network and then just click this download it takes a little while to to start up and once it's finished I'd recommend you restart your computer because with mine I was having some weird graphical issues with the the browser so I'd recommend you just restart your computer and then after that so make sure you have Anaconda Navigator installed as well I'll leave a link to the install and your environments all of your environments before you installed Cuda are not going to register your GPU I tested this out I'll test it out again just to show you so I'll just use reinforcement learning use this environment and you'll see that um once I started up you go to Jupiter lab I recommend you have Jupiter lab installed for this it'd make things a lot quicker and easier so you just go to Jupiter lab I already have this test notebook put up you're gonna have to install this but we'll go into that after I show you this so if you go and go through all this import torch and type in Cuda dot is available it comes up false now it already had true set up here because I ran this in an environment that I instantiated after I installed Cuda but if you try and run if you try and use your GPU in a environment you've already created before you installed Cuda it's not going to work so now that we've got this all set up you're going to want to go well first of all make a new environment I'm just going to use this test environment I made and you're going to want to give it a pie torch Pi tour Pi torch Cuda [Music] and okay that's not that's not probably so you want to go to Pi torch Cuda [Music] here it says start locally and you're going to want to pick pick whichever one of these when Linux Mac Windows I'm on Windows I'm going to use pip you can here I'm using Anaconda but you can use pip inside of anaconda and I'd recommend that and then I'm using Python and then this one you're going to want to copy this command so just copy that and I'm going to go back to my test server my test environment on Jupiter lab I'm going to relaunch Jupiter the Jupiter notebook to restart it and you're just going to want to put so you copy and paste this line then put an exclamation point at the beginning so that it runs in the terminal instead of in the thing and it's going to go through all this it's going to take a while it'll take a while to install don't worry about it and it's going to do all that install everything then you're going to want to import torch just to check to make sure it's working and if you if you run these and you get back see torch.cuda dot is available so now it says true and that just means that it's available Cuda is available to use and torch automatically use this Cuda when it's available but just in case you can do torch.cuda.currentdevice and obviously mine zero and then you can do torch.cuda.getdevice name and if your zero comes up as something that's not a GPU for me this is my GPU if it comes up as like a CPU then I would recommend either making a new environment or restarting this environment just to check just to because it it might have been some kind of weird bug you never know so um yeah that's that's the install process watch it should work if you were to you know import everything else now that you've installed all the torch and the Cuda so if you you know wanted to make a whole project out of this it would run on Cuda instead of it would run on your GPU instead of your CPU so yeah that's it thanks for watching bye
Info
Channel: SavorSauce
Views: 26,791
Rating: undefined out of 5
Keywords: PyTorch, CUDA, PyTorch Tutorial, CUDA for PyTorch, How To, CUDA Install, NVIDIA CUDA, Install CUDA for PyTorch, cuda, pytorch, pytorch tutorial, PyTorch CUDA, PyTorch Install
Id: d_jBX7OrptI
Channel Id: undefined
Length: 5min 10sec (310 seconds)
Published: Wed Jun 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.