Install Pytorch Ubuntu | How To Install Pytorch On Linux For Cpu Or Gpu – No Driver Install Needed

Jeff Heaton

Subscribe Here





How To Install Pytorch On Linux For Cpu Or Gpu - No Driver Install Needed


Okay, let’s install pytorch so that you can use it for deep learning with Python on Linux now. This is Linux for the desktop. I’m using a Lenovo Thinkpad p53 which Lenovo was kind enough to give me for the Youtube channel for a couple of weeks, so we’ll see how to do this on Linux on the desktop we’re using Ubuntu in this case. [MUSIC] Okay, here we are in Linux. So the first thing I’m going to do is go to my Github repository and use chromium. And here we are at my Github repository. You’ll go into my deep Learning, course install and go into the pie torch July 2020 version of it. If there’s a later one, then definitely follow that one. So the first thing we’re going to do is install minicondo’m. Now You can use the full blown anaconda If you like, but I prefer to not have everything in the world installed at 1. I do say python37 here. 38 is now available, so we’ll do 3 8 You can see here. We have for Linux. We’ll do python38 we will download this version download. Whatever the latest version here is, we’ll download the specific, we’ll create an environment that has the specific version that you need for pytorch later, So it’s downloading this. This is essentially a file that a shell script that we’re going to give permission to execute and then execute while that’s going, I’m going to go ahead and launch my terminal. Okay, it’s done, you can see it here. Actually, I have to go into downloads and there’s the the version of it. I have to do a chmod plus F Otherwise, we, whoops. Otherwise, we won’t have permission to to run that, and then I’m going to go ahead and run it. Welcome to python38. Go ahead and press enter to continue. Go through all of this and we’ll say yes, and I like that location. Lenovo is my user directory that Lenovo set up as the the default for this computer before they sent it to me, and it is grabbing all that I need. This may take a moment so I will go ahead and fast forward through this. And yes, we do want to initialize i’t. This lets us hook into our shell so that it can interact with the operating system properly. Okay, and we’re done. We have installed miniconda3 now. I’m going to go ahead and install Jupyter copy this. This is essentially the ide so to speak integrated development environment that you’ll be working on with this. Oops didn’t copy and paste everything. I should have Conda. Install jupyter, okay. It has to figure out all the needed things for this. We will go ahead and fast forward through this part. Okay, that’s done so now I’m going to create the environment now here. It specifies the version of python that we’re going to use. I’m going to actually use 38 because it’s supported by torch that I’m installing. You might be able to put a later version on there. There is a python 39 but not everything that I need is yet supported by that, and I don’t think Anaconda As of right now, which is just a few weeks after three nine was added. I’m not sure everything is completely up on that, so I am going to go ahead and run this command, but I am going to do python38 now. If you put too late of a version in there, then you’re you’re just going to get an error down here when you try to install torch, it’s just going to tell you it doesn’t exist because it doesn’t exist for the version of Python. You’re trying, so I’m going to go ahead and do this put 3 8 in there and I’ll probably update this instruction soon, so we’re creating a Conda environment called torch that is running python38 and I’m going to say yes. This takes a moment, so we’re going to go ahead and fast forward through this, all right. This is ready, so I’m going to do Conda. Activate, okay. I think I need to restart my shell. You might get the same error so restarting my terminal. Ah, notice I have this base here. That used to not be there that lets me know. This is working, so I’m going to do Conda. Activate torch. And now I’m in my new torch environment and going down here. I am going to now install envy Conda because that’s going to be needed to link the Jupiter notebook to this environment after I’m done installing everything, so that way, it works good with Jupiter, We’ll see Jupiter momentarily, All right, I’ll let this run and fast forward through proceed. Yes, fast forward through this part all right now. We are going to actually install pytorch now. You have some options here. If you want to do the CPU only or for GPU and CPU. This computer does have a GPU on it is a Quadro Rtx 5000 which is a quite a nice GPU. So let’s make sure we can take advantage of that, So I’m going to copy this line and if you installed too late of a version of python that there’s not a pie torch available for it. This is the point at which you’ll get an error. Then you’re just going to want to redo that previous step where you created the environment and back down your python version a bit, so I’m pasting that into here. Hopefully it finds it and everything is good. Yep, no problem, so we’re going to go ahead and run this. This takes a little while because we’ve got to install the cuda toolkit which is needed for the GPU and all of that. This takes care of your drivers and everything you do not have to worry about. Installing external drivers like is normally a real pain in the neck. As far as GPU is concerned, okay. Pi Torch is installed. Now there’s some other tools that I typically like to use with these, so I will run this tools. Gamo file. If you want to get that file, let me go ahead and there’s actually a link here, so I’m going to right. Click this and do copy link address. There’s several ways to go about doing this, but we’re in Unix, so I can do wget to download it paste in the path and there there we go and I am going to now. Run this Conda. Environment update command. These are basically all of the additional libraries that you would need for my machine learning class, but they’re good. I think they’re a good starting point running that now. We’ll go ahead and fast forward through this. This does take a moment and again. Make sure you’re in the torch environment. Not that you would have changed out of it, but if you happen to restart or something, you do need to be in that environment. You can ignore that. Conda, activate. It’s done now because everything we’re going to use torch. You don’t want to activate it directly by the path. Next step, you need to register your environment, So this is basically just putting the entry inside of your Jupiter notebook so that it’s able to find it. This registers your kernel. Now I’m going to change that 3 7 to 3 8 This is really just a string that is displayed to the end user in Jupiter, But I like to have it correct, so I’ll press enter and run that, and that’s very quick. It should be there now. So now I’m going to launch Jupyter notebook. We should be pretty much done, okay. We’re launching it. It opens up another browser window. I am going to create a new notebook. You’ll see the options here. These are other ones that I installed like. I have one for rapids! We’ll do 3 8 pi torch and Python is now available. You should be able to print Hello World, and that’s available. I’m going to go back to my instruction page because I have some useful code there that you can make use of this will test your environment and tell you what version of Pi Torch you have. And if the GPU is available, I’m going to paste that into there and execute it. GPU is available. That’s always a happy moment. If it’s not, I very much suggest restarting your computer. Sometimes that makes a difference, but if if you followed all the steps, okay, you should now be here with a working pie torch environment. If you want to actually do something real with it, I do have an example. My my course is primarily Kera’s tensorflow. But I do have one example here and growing. You might hopefully see more if you go to Pi torch in my deep learning course. And I have a environment here or a work notebook. That does the Iris data set. So this shows you how to actually do this. It’s all pretty much in one pane you could. Oops, that’s important. You could download this notebook and run it that way that might be easier, but I’m just going to copy and paste it here, just so I can run a quick example, okay. Its training trains do a lower rate 0.56 loss. That’s pretty close to what this had trained to as well copy this as well put this into the next cell. Run it and we can see the accuracy is quite good. Iris dataset is not not that hard, all right. Thank you for watching this video, and if you’re interested in all things, deep learning, Ai, please subscribe to my channel. Let me know if you want to see more pie. Torch videos in the comments.

0.3.0 | Wor Build 0.3.0 Installation Guide

Transcript: [MUSIC] Okay, so in this video? I want to take a look at the new windows on Raspberry Pi build 0.3.0 and this is the latest version. It's just been released today and this version you have to build by yourself. You have to get your own whim, and then you...

read more