Installing PyTorch for CPU and GPU using CONDA (July, 2020)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi this is Jeff Heaton we're going to take a look in this video at PI torch now I've covered mostly Kara's and tensor flow in my videos so this is a bit of a new direction I'm going to start really at the very beginning I'm gonna do an installation video very similar to the technique that I used to set up Kara's tensor flow for my class so we're gonna look at how you would install PI torch into a Conda environment both for the CPU and for the GPU to see all my videos about kaggle neural networks and other AI topics click the subscribe button and the bell next to it and select all to be notified of every new video okay so let's get Pike Arch installed the instructions that I'm following this are basically contained on my github repository so if you just search for github and Jeff Heaton and this is my github repository if you go to t81 5:58 this is my course on a deep learning this is mostly a tensor flow oriented course at least at this point but I'm starting to add some PI torch examples to it so if you go down here to well first of all before we do that let's go ahead and download the entire repository so I'm gonna just download a zip file so here's my course applications of deep neural networks this is mostly a cancer flow or inted course but I am starting to add some PI torch examples too as well do you want to see more PI torch for me definitely click that like button let me know that's how you cast your vote for this thing and it helps me with the YouTube algorithm as well always a good thing I'm gonna go ahead and download my repository get that at least going in the background somehow I have two of them ok so now I have one downloading will let that continue but if you go to the install directory this is where we have the instructions on how to install PI torch and this sets it up oriented to my class which is really a good setup for most general deep learning that you might be working on so here's the instructions for this the first thing that I suggest installing is manaconda now if you want to just throw everything and the kitchen sink into this feel free to install anaconda these instructions will work just fine but I'm going to go ahead and click on the medic on the link and I'm going to download Python three seven always grab the latest of this we're going to create an environment with which version we specifically need but I'm going to click this one and we've now got multiple downloads going at once which is perfectly fine I'm going to go ahead and fast-forward through this okay it's done let's go ahead and run manaconda I'm gonna go ahead and do next good agree I'm gonna install it just for me this is not a multi-user system and it's going to stall it under my user directory which is fine I do actually add it to the path it warns against this the only real downside is you might be messing up other software or on your computer that makes use of Python I found usually such software kind of has their own embedded version or other things this is primarily a developer computer so I'm just gonna do that if you don't do this you've got to do everything through the meta Konda prompt rather than just the straight-up Windows command prompt but I'm gonna go ahead and click install and it's installing this is really pretty quick if you're using anaconda the full-blown one this is gonna take much longer however I'm gonna still go ahead and well it's actually done so no fast-forward needed finish alright I'm not gonna register I already done that let's go back to my instructions here so the next thing I'm gonna do is kinda install Jupiter because we want Jupiter notebooks available and we want this installed in our root environment so I'm gonna copy that and open up a command prompt and I'm going to just go ahead piece that in press ENTER and it's gonna ask me to actually it doesn't ask me to prove it just goes for it I had the Y option in there well fast-forward this this takes a little bit actually while that's going I am going to multitask and we've got that zip file that contains my entire course I want to double click that and that's the the directory that's contained in there I'm gonna open up a and one of these and go to my user directory and by the way this is a fresh install of Windows so there shouldn't be any conflicts going on I'm gonna copy it there fix it a moment to unzip that so that's ready to go at this point and now Jupiter is still going here it's almost done but I'm still gonna fast-forward and skip this final part okay and now it's done so let's go back to my instructions we're gonna create the environment so I'm gonna create a new environment called torch this is Python 3 7 I tend to generally run tensorflow and torch in separate environments so I'd like to use both of them in the GPU and they might sometimes depending on the version require different CUDA libraries and that can that can cause some issues so I'm just gonna set up torch in its own completely separate environment we're gonna install it for GPU but it's easy to install it just for CPU if you need ok I'm gonna run that this will take a moment because it needs to install another instance of Python 3 7 and it's done I'm gonna go ahead and Conda activate it that's actually the next step in my document but Khanda activate torch you can see by this we're now in the torch environment that I created see kinda activate torch that's what we just did now I'm going to do this part this installs some utilities that I'm going to need later so that I can add this environment that I'm creating to Jupiter so I'm gonna paste that and it's going to go ahead and do that I'm gonna say yes this takes a moment I'll fast forward it ok it's done so now you have a choice to make do you want to install PI torch for the CPU only or for the GPU and the CPU now if it can't find your GPU it's just gonna use the CPU so you can kind of choose really either of these but if you're not gonna use the CUDA toolkit you you might not actually need that I'm gonna go ahead and run this version of it here that should support both of those one thing that does seem to be different about pi torch and I've used it much less than tensorflow so if anything I'm saying here please give me comments in the comment section but this does get me a working version of this that that I've been used to begin some of my experimentation but it does seem that PI torch has a lot more of the GPU toolkit and and such built into it so you don't have to to deal with that as much as you do in tensorflow so I'm gonna paste this here and I am going to go ahead and run this it's coming right from the PI torch channel so they maintain this distribution for it so I'm gonna press Enter does a bit and I'm gonna say yes now this does take a little while so I'm going to go ahead and fess for it by the way while this is going I will also mention as far as GPUs you need to have a Nvidia because they support CUDA which is what PI torch uses here there may be other ways to use OpenCL with pi torch but this is primarily what I am focusing on I run a lot of the stuff also in the cloud and for the AWS instances and and others it's primarily NVIDIA GPUs that they give access to or or TP use sometimes as well all right that's installed so the next step on my list is to run this now we need to get this file from that zip file that we downloaded so I'm gonna go ahead and move into that directory and then we can run this command now this installs various like scikit-learn and other packages that you need for my class but they're also really a pretty good complement of machine learning utilities that you would probably need anyway so I suggest installing them you can definitely open up the file and have a look at what on in there okay it's installing all of these additional machine learning libraries used in my class the class by the way is a deep learning applications of deep neural networks and it's taught at Washington University in st. Louis I teach one class at a university alright it tells me to activate this don't worry about that we're still in torch so make sure that you you're in whatever environment you created this is a very important command if you do not run this command you will you will not see your newly created torch environment in Jupiter this runs very quickly I am just going to press an or make sure you're in torch to do this the next thing we're going to test the environment I'm going to run this Jupiter notebook now it's very important especially in Windows or only in Windows that you switch to the environment that you want to run before you launch Jupiter notebook otherwise it might not find all of the DLLs now this is particularly a problem and tensorflow I'm not a hundred percent sure that pi torch has this issue in Windows but in Windows I just get numerous weirdness going on if I try to be in one environment or in my base environment and run other environments so always be in there I'm gonna run Jupiter notebook it's just a web browser that pops open and this is all of my course material all of these lecture notes are set up for tensorflow so let's go ahead and look at the install script that I gave you because that is set up for PI torch I will definitely be adding more PI torch samples as we as we go I'm gonna just go ahead and first of all make sure that we are in Python 3 7 torch but if you're not make sure that you are in the kernel that you that you started this in and I'm going to do kernel restart and run all and it'll get down to the bottom here and you can see it was successful we have pine torch version one point five point one you might have a later version if you're running this later on and the version of Python and GPU is available so that's that's quite cool thank you for watching this video if you're interested in other things related to PI torch please click like on this video let me know and this is this is an area that I'm considering doing additional videos on thank you very much and please subscribe to my channel
Info
Channel: Jeff Heaton
Views: 30,231
Rating: undefined out of 5
Keywords:
Id: vBfM5l9VK5c
Channel Id: undefined
Length: 11min 21sec (681 seconds)
Published: Wed Aug 12 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.