Install Tensorflow/Keras in WSL2 for Applications of Deep Neural Networks

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
for this course you're going to need a installation of tensorflow and Keras with python you have a couple of ways to go about that one is to use Google collab however this video is about how to set up a local environment of python with a GPU using wsl2 on a Windows machine and the way it's set up you have to use wsl2 this is just how tensorflow is currently distributed as of 2023 in March so the very first thing that you want to do is install the Nvidia driver also I focus primarily on Nvidia I don't have AMD technology AMD technology is not real common in the cloud and so it's it's just not an area that I focus upon and it's it's a more complex path it's not supported as well in the machine learning thing and I'm all about the path of least resistance now my GPU which written video was awesome to provide for this video is an Nvidia RTX 6000 Ada generation really any GPU that is shown here is is going to work just the 40 series is certainly going to be faster than the 30. which is faster than the 20 and so on and so forth so let's go ahead and search and we shall download it agree and download I'll fast forward to this depends on your connection speed how long this takes okay it is running I'll say yes okay it's installing I'm gonna have to stop my recording because we are modifying the video driver so the driver is now installed so we're back here on the wsl2 now what you're going to have to do before you hop into any of this is you need to install wsl2 and for this we're just going to open up a Powershell and we're going to do WSL minus minus install and you have to give it the appropriate permissions and it's Off to the Races we'll fast forward through this part it does install Ubuntu by default certainly the path of resist resistance which I'm all about okay the system needs to be rebooted so I'm going to stop my recording for that so we've already completed a number of the steps here we have the Nvidia driver loaded we installed wsl2 and we've restarted and specified our user ID and password and remember those because you're going to need them later now we're going to install Python and tensorflow so we're going to make use of Anaconda specifically minaconda now I am using the version of Anaconda that was suggested by the current documentation for Kira's in tensorflow this tends to update as this video ages so these installation scripts which are specific to the course or based on this document which I'll put a link to in the description as well it's important that all the versions line up so you can see right here these are the current versions that they're suggesting for the current version of tensorflow and the current version of tensorflow is down here 211.star is the current version of tensorflow and this is the current versions of the Cuda toolkit and kudi net that follows just this document and does not install any of the specific stuff to my course I'll put a link to that as well in the description so we're going to run these commands here let's go ahead and get Powershell open and there we have Windows Powershell I will go ahead and copy the curl command that does the download I do like to run these separately that way I can see what is going on when something goes wrong all right it's downloading that we'll fast forward through this okay we have downloaded Anaconda now we're going to actually run the install script that we just grabbed actually it's not little it's pretty big all right paste it in we'll run that okay we'll press enter to continue lots of stuff to read yes we accept the license not like we have a choice we'll install it there and it's doing its installation I'll go ahead and fast forward this yes we do wanted to initialize the shell I'll show you what that does right now actually so the shell lets you know which virtual your environment you're in and issue certain commands right from the shell so we're going to continue following this down here we're going to exit and then go right back into WSL and run WSL notice now we have this nice base here that means we're in the base environment before we install anything else we are going to go ahead and install Jupiter this is the IDE that we use in this course certainly more advanced ones out there Jupiter Labs pretty nice we'll go ahead and run this and it's going to install Jupiter it's installing it to the base environment and this is going to allow us to get to the other environments that we'll set up we're going to set up just one to run the course now this is installing I'll fast forward through this and there we are so now we're going to run these commands down here this will download the tools.yaml file this configures all of the software that we need for the course and this includes the Cuda libraries and tensorflow this is the file that you may want to manually edit the versions if you want to move it to something later from what I put together at the beginning of each particular semester so we'll put that there that'll just download it it's a very short file we're going to run this command that will execute that tools yaml file and create a virtual environment called tensorflow This is actually a virtual environment inside of a virtual environment because WSL is a virtual environment itself we'll run this this takes a little while so we're gonna fast forward through it so that took a while but we're done we will follow along and we'll go ahead and do conda activate tensorflow you'll see that base becomes tensorflow we're going to run this part so that our newly created environment shows up in Jupiter that installs the necessary tools for this to happen well fast forward we will proceed all right that's done that now allows this command which actually adds our new virtual environment to Jupiter that's very quick all right we're getting there so let's go ahead and run these lines of code this causes the library paths that are necessary for tensorflow to find Cuda and the other libraries so we'll paste that in run that that's very quick as is this all right we've installed a lot of stuff I'm gonna stop the video and reboot at this point okay we are rebooted so let's go ahead and open up a Powershell and we'll launch WSL I'm following the instructions that I have right here we're about to run Jupiter notebook I'll add the Run WSL there another thing that is very critical to do particularly on Windows platforms even when you're in WSL 2 is you do need to kind of activate tensorflow before you even launch Jupiter notebook and likewise if you change environments make sure you come out go back in that does tend to work better on real Linux and Mac so we're going to open up the notebook I'm going to just create a new one and we'll just kind of paste this code in paste this here and we're going to run it and see what happens if things go off the rails this is usually where it happens and look at this an explosion of Errors well not really and GPU is available so the key thing is this tensorflow tends to just assume that extra things are there that you might not have like Nama if you'd probably want to compile that in if you've got like multiple CPUs although in that case I'm not depending on the CPUs because I'm doing more GPU so these are what they are if you're getting GPU is not available look at what some of the ones that you're getting beyond the normal ones that I'm getting here and Google and post in the comments because believe me every time that I go through this and update for a semester I look at what problems people have had I don't have time to help I get so many emails and I do feel bad but I don't have time to sit with individuals and and help them install this believe me I could probably spend all my time doing that there's so many so many questions I get asking for one-on-one help unless you're one of my students that works you then you get one-on-one help all right now that you've got this all installed you're ready for the class was this helpful please like And subscribe
Info
Channel: Jeff Heaton
Views: 10,675
Rating: undefined out of 5
Keywords:
Id: KinTNHO-6IY
Channel Id: undefined
Length: 9min 56sec (596 seconds)
Published: Mon Mar 06 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.