Deployment Of Machine Learning PIPELINES Using Dockers and Kubernetes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello all my name is Krishna and welcome to my youtube channel so guys today in this particular video we are going to see how we can deploy machine learning pipelines on Google Cuba net engines we are going to use both talkers and Cuba nets now many of you are waiting for this particular video and the whole video is basically dedicated to the blog of moyes early mostly if you don't know guys he's the author of I carrot which is an automated machine learning library and he has explained this blog amazingly you can see all the description all the information properly documented in this so if you really want to learn about to Burnett's about dockers this is the way anyhow many of you are also waiting in my playlist regarding Cuba net so we'll try to see how do we do the deployment of machine learning pipelines by using this Google Cuba nets engine so I will be referring this whole blog guys and I'll also be taking his the code that he has actually put up in the github and remember that particular code is actually implemented with the help of I carrot it is pretty much amazing the code implementation is there I'll be able to show you I'll just click on the github link so this is basically the code implementation ok you can see over here he has one IPIN be filed in this particular file he'll be creating the model okay so this pyn beef i will be creating the model this is basically my model dot decal you can see over here he also has one app dot t-- y which is basically he's using the flask app he has static and templates for the index dot HTML and the result dot HTML and static is basically having some CSS values okay and he has this g-cloud ignore various to ignore some of the files which is not required so all these informations are play placed over here and finally you'll be able to see that after the deployment the output will be something like this this particular application is all about predicting insurance bill so you can see over here this is what we are going to predict the insurance bill where we put some information with respect to each and every field and then we click on predict right so we are going to actually going to implement this and after deploying into the Cuban it's now first of all if you don't know about my characters it is an open-source slow code machine learning library I have implemented many videos and uploaded that videos in my channel then Google cloud platform I hope everybody knows and please if you don't have Google cloud platform just go and sign in in the Google developer console there you will be getting $300 credit skies and that will be valid for one year you can do many things will learn many things as such now let's see what is Cuba nets okay so Cuba nets is a powerful open-source system developed by Google back in 2014 for managing containerized applications when I say containers at application I'm talking about Dockers if you have seen my playlist about Dockers have explained about these all things now in simple words cuba nets is a system for running and coordinating containerized application across a cluster of machines that basically means guys in short cuba net is basically used for making a scalable model ok i'll be showing you how to implement it here only in this particular video so this video is going to be little bit longer than the usual video I think probably more than 30 minutes I think it will go till but you should understand that if you want to make your model scalable at that time you have to use cuban it's ok so we are going to see this ok so what are the features first of all it will help us to do the load balancing suppose I have three four clusters you know and suppose in one of the node all the requests are going then they can also distribute those requests from the front end to different different clusters itself scaling you can see that it automatically scales up or scale down by remove adding or removing containers when demand changes such as peak hours weekends and holidays right so storage keep storage consistent with multiple instances of an application there is also functionality of self-healing and automated rollouts right now the most important thing is that why do you need queue Burnett's if you have docker imagine a scenario where you have to run multiple docker containers or multiple machine to support an enterprise level ml application so here is all the information guys it is an amazingly written blog you can definitely have a look now what I am going to do is that I'm just going to come back over here and I'm just going to try to show you how we are going to deploy this particular machine learning pipelines okay so let's go ahead now first of all I am just going to show you the github so this is my github okay you just have to follow the same steps and all the steps are also given in this particular blog guys I am going to follow the same steps and I am going to suggest you to do what all in the next steps okay so first of all just go to your Google console okay so I am just going to go to my Google console so Google console here it is Google Cloud console I am going over here so it will just ask you for the login make sure you have an account guys it will be you'll be able to use the 30 thousand rupees or three hundred dollars or thirty thousand it is somewhere on 22 to 23 thousand so three hundred dollars it is completely for free you can actually use it then you go over here click over here go to the I am and admin okay in the I am an admin you will be able to see something called as manage resources now click on the manage resources guys click on the manage resources now here are basically all your resources that you want to create and then this is done just go back okay just go to your home inside the home here on the top you will be getting some options for selecting the project select the project that you want to work on currently I am working on this project so you can go over here click on that so once you click on that you will be able to see this after this what you have to do is that case there is something called as and remember when you are working with Cuban it's what all things we are actually working on first of all going to this there is something called as container registry this container registry is pretty much important guys because I understand when we are working with talkers what happens is that we usually upload the docker images into the docker hub now similarly container registry is the hub in the Google cloud platform okay for the Dockers itself then you have something called as Cuban eight clusters or you can also say it as Cuban it's engines here we are actually going to create the clusters okay so here understand Cuban eight all the clusters will be created here all the docker image will be uploaded okay now that is done now let me go to the next step you will be able to see something called as activate cloud shell this cloud shell is basically you know it is just like a command prompt over here like a Linux environment where you can write all your queries okay so all your queries will be written over here all the kind of operations that you want to write it you can be done away so basically what you're going to do you're going to create your docker image over here you're going to compile your doctor image over here okay after compiling the docker image you'll also be creating the clusters you can create your clusters through the command prompt only I am going to show you all the commands that is going to be used apart from that in the blog also it is been written clearly what are commands you have to use step by step okay now I am over here okay guys so what I'm going to do is that I'm just going to see my LS in my LS you can see that there is already PI carrot deployment Google okay now how did I get this remember this is basically my github right this is my github for this particular file I mean sorry boys Ellie's get up okay this is the Moi's Ellie's get up documents what you have to do is that just go and click on clone or download just copy this get come on okay copy this path come on not get come on copy this part come on once you copy this go to the Google cloud platform over here and what you have to do is that just right okay oh this is good I'm just going to be connected it is got disconnected but it's okay it is open over here also I can use this what I'm going to do is that okay it has got reconnected guys so I'm not going to edit all these things I'm just going to make it because any problems that I face I probably think we should be able to solve it away now what I'm going to do over here I am going to write git clone and I'm going just going to finish that whole path of my current deployment Google okay remember guys this is the the Google the github repository of Pi carrot which is owned by Moyes early and now what I'm going to do is that over here I am just going to press ENTER okay once I press enter you will be able to see Fattal destination path already exists and it is not an empty directory perfect so if you really want to remove it first of all what you do is remove this directory so I'm going to remove this particular directory first of all I'm just going to write PI carat and I just going to press Enter if I write LS you can see that guys I'll just zoom in if you see LS now I don't have that particular path again I'm going to clear the whole thing and then I'm going to paste the same thing or the previous command that I had actually written so I'm going to make the git clone again of that particular repository if you have already done it guys no need to do it again now if I go and write LS you'll be able to see I have something called as I current deployment - Google so inside this particular path I will go because all my files are present inside this and now if I do LS you can see the whole files present over here the most important file is the docker file the requirement or txt my model file is there or not my config file is there not everything is there guys so now I have done the git clone ok I was able to do the git clone I am going to clear the screen now one more important thing that I want to see if you want to really see all the files I can also click on open editor now open editor will actually open an editor on top of it let's see so it is also called as a cloud shell editor in that editor also you will be able to see the whole structure of the files that is actually present okay so probably this will take more time when compared to the previous one console it was pretty much quick we'll just see with respect to the cloud shield editor now this is amazing right now here you have all the documents you can see that so this is cubed office this is this was no I'm good good just wait to see this I carry deployment boom so here you can see all the files right you have your readme requirement dot txt you have a config dot where you have a PAP dot T Y if you click on app dot dy then you can see the whole code over here right what is the code the whole code away if you want to see the config dot py you can see it over here right everything you'll be able to open it so what I'm going to do I'm just going to close this I'm going to go back to make so here I have my this one and so right now I will start my operation now this particular steps are important is all the steps are being mentioned in the block and again the link will be given in the description of Mozilla so you can actually see each and every think I see each and everything you can actually check it out ok so let's go to the next step now what is the first step after creating the project I have it clone the project the next step that is that step third will basically to export this particular project ID so I am just going to create a variable which is called as export project ID project and just creating a global environment variables is just like a global environment variable and I am just going to give my project name to this oops ok I'm just going to give my project name to this so here it is and I'm setting this project ID to this particular project name I'm going to press Enter ok now the next step what I am going to do is that we have to quickly build the docker image okay now before building the docker image guys what you have to do is that we can write a command docker build ok remember guys all these steps step by step it is given in the complete box but since your seeing in front of me you can also implement as I'm implementing okay so it is going to take time so please make sure that you implement this in front of me okay so then I'm just going to use GC r dot IO now if you don't know about GC r dot IO guys this is the Google container Google repository that I have actually shown you container repository Google container repository right over here you can see that it is not there and initially this will not also be enabled guys you have to enable this API for the first time both for a container repository and for the Kuban X engine this both will be disabled you have to enable it okay now what I am going to do is where I just want to write build GC are what are you that basically means I have to build this particular with respect to this particular container repository and I am going to give my path with my project ID okay so this is my project ID this project ID is you know that it is initialized to something else right so it is initialized to something else so here after this after you are writing this particular command you are just going to write the the app name in short you what kind of app name you want or what kind of the docker image name that you want right because we are actually building an image over your doctor image itself how you are building it we are considering the container deposit Google+ we are giving the project ID this is basically the path ok GC r dot io / the project name / my docker images so what I'm going to do is right I'm just going to write insurance ah : version 1 I'm going to use the version 1 I am going to use a dot just go and check my docker videos guys how I have actually built a docker images that you'll be able to understand now once I press ENTER it will probably take some time for doing the building purpose also and it will build this particular images after building guys we can also write docker images to see the images has been built or not so probably if you remember this let me just go to over here inside my daugher fine so this is basically my daugher file and inside the docker file you can see that what all things he has written ok boys has actually written from Python 3.7 we are going to first of all clear a virtual environment then inside this particular virtual environment we are giving the path the working directory this and then we are installing all the requirement DHT then we are exposing 8080 as the environment port and then we are using this command prompt ok there is also a config dot py5 you can also refer that so yes this is what it is actually rough and running over there you know and based on that you can see that it is creating a virtual environment now probably it will take time for all these things guys because there's so many things that we need to do in this you know so probably the video is going to be pretty much longer and as I said that I am NOT going to edit this ok so yes all the downloading is actually happening you'll be seeing guys once we will be creating this whole thing after creating clusters and when we are pushing those things it the size is going to become bigger as we go ahead but yes we'll wait till this thing's goes on then till then I'll explore the next steps what needs to be done because this I will be doing it in front of you let me just come back to this particular repository of this particular blog itself you can see that after I caught the cloud shell I've done the git clone after doing the git clone I have set the project in environment variable then we have build the docker images builder daughter images and target for uploading by executing the following code this is basically the tanks v1 is basically the tank ok then you can check the available images by running this particular code let's see probably it's taking a little bit time once it is done we will be able to see the docker images and yes because when by default over here if I just go in the requirement or txt ok my carrot will also be there right and by carrot house dependency has various things so my carrot is an automated library still it has dependencies on various things right so it is basically loading all those things and shot oh yes so building will for sharp set up dot py started everything is happening to be okay till then we'll explore this okay blocks so once we have the talker images then we authenticate to the Container repository this is required guys because understand on which container we are actually going to deploy or push this docker image this is just like a talker huh okay that is what we are going to do we are going to upload the container image in the container register itself after this execute the following code to upload the docker image to the Google container repository you can see that I am pushing it over here oh here by using this command then in the step 6 we create clusters by setting this to lines of code then we will also be creating clusters and number of nodes also we can give over here ok make sure that you can give give less number of codes just for practicing guys don't don't give that much then finally we'll be doing the deployment of this particular application ok by using this command so we will be doing that step-by-step so guys now we were able to successfully build the image and probably took somewhere around 10 minutes and it depends on your internet speed also guys and how much time it is actually taking to build this it may differ from system to system but now we are going to go to the third step and we are going to see that whether the docker has been created or not so unlike images so I can see that there is a docker image of GC at i/o Cuban I test this insurance app with tag v1 and Python Dockers so - Dockers has been created because this Python is basically from the virtual environment which is actually running in our which was present in our Dhaka file it's right so I'm just going to clear the screen and we are going to they're going to go to the next step in the next step now what I told you that we need to we need to basically configure this container registry right now in order to do that I'm just going to copy and paste one command which is G cloud that is Google Cloud auth configure docker and here we will basically write our GC r dot io this is basically the content registry name you can see that apart from that in my system I have others like us dot GC r dot io e you this but I'm actually going to use this so this will get successfully registered after this I have to push the docker to that particular container repository so I'm again going to clear the screen and for that I'm just going to use a command which is called as docker push which is pretty much similar to whatever we did in the docker story'll GC r dot io and then i'm just going to write it as taller and this I am going to use my project ID because understand why I am writing this command because in the same path my docker image is actually present right so here I'm going to basically use Stroh second yes Here I am going to basically use insurance - eat eat eat hack and the tag version is v1 so after I do this okay saying invalid format why let's see somewhere I think some of the problems are there first of all let me just go and see my daughter images image okay docker images it should we talk her images okay it is cuba nets test okay cuba net test project ID okay insurance app version me one okay so probably I'll just try to write it down again because this looks a little bit mistakes I have made some kind of mistakes over this I'm just going to rain talker push GC r dot io / dollar there was some spelling mistakes that I am a native project underscore ID and then I'm just going to write insurance now it should work so we are now pushing the Dockers into the container registry so there was some spelling mistakes in project underscore ID I made it - ID so because of that I think there was a problem with respect to that so this portion is going to happen how big my docker image is basically it is going to get pushed and again guys this will also probably take some time it is all it it will definitely take some time because those are file you need to push it in so basically you know after this gets successfully executed and if you refresh this you'll be able to see the file over here so probably will wait till this gets pushed so guys the deployment has been done so basically we have pushed the image to the Google container we repository so Google container repository now you can see that over here we don't see any images but as soon as i refresh you'll be able to see one image so insurance app is my image name that has been present over here you can see the dollar symbol over here the tag name is v1 let's move to the next step now the next step is basically what I'm going to do is that quickly I'm going to make some clusters so that you know we also have to decide the clusters in the cuba nets engines right how many clusters we basically won so for that we will be proceeding with the next step and before proceeding to that step guys let us set up the zone you know and for setting up the zone we will be using this command and first of all I'm just going to clear it and I'm going to paste this so here it says that g-cloud config set compute slash zone is I'm just giving it as US Central one remember guys all the steps again again are given in the blocks okay you can also read them but this is basically to set our zone so currently I'm just selecting it as US Central one there is also like western zone and different other zones you should can explore by searching in the Internet itself now what I'm going to do is that I'm just going to press Enter so once this zone is set now what we are going to do is that we are going to create the clusters inside this cube and let's remember Cuba Nets are basically it helps the model to be more scalable think it extends the scalability of a specific machine learning pipeline so for that we will try to write a command and now we will be creating container will basically create clusters now for that what I'm going to do is that guys I'm just going to again copy and paste one command so here we have g-cloud container clusters create insurance dash cluster so this is basically my cluster name and the number of nodes that I basically one is two but here what I'm going to do is I'm just going to make it as one remember guys when once you do the deployments once you do everything just disable everything otherwise there will be charges that would be incurring yes it is fine till you are using the three hundred dollar free credits but after some time it is better that you shut that down you also have to give your credit card so it is please make sure that you shut down the application once you use this so I am just going to make this flusters while making these clusters guys you can see that over here right right now we don't see any clusters but after this gets executed the clusters will get created guys so and probably this will take a little bit of time you can see that I am fast-forwarding some of the clips where all this kind of installation will be taking place so here also I am just going to fast forward a little bit of time okay guys the cluster has been created now the next step is basically to first of all I'll clear the screen and after that I'll just also verify it from here you can see that my clusters has been created over here right now the next step is basically to deploy the application I'll just go over here guys our next step is to deploy and manage the application on GAE clusters you must communicate with Cuban eight clusters management system execute the following compound to deploy the application let me discuss first of all the commands it says cubic tell you basically say it has cubic tell create deployment insurance app and then I'm just going to give my image path where this particular AB image is actually present so I'm just going to copy this and go back to my command prompt over here I can also share my shell then I'm going to execute it and now the deployment has actually started you know so the deployment is taking place guys and it will probably take some amount of time in no it does not so yes it is done now the next step is that guys once the deployment is done using you know what we do is that we have to expose our application to the Internet so in the step wait basically we need to expose your application to the Internet by default the containers that you run on GA GK make is it means Google Cuba Nets engine are not accessible from the internet because they do not have external IP address execute the following code to expose the application to the Internet okay so what we are doing over here we are just saying that from port 80 the target port is 80 80 why I have selected 80 80 because just go into our deployment section so you go to our file here in the docker file also we are actually exposing 8080 okay so here you can see that guys we are exposing 8080 so make sure that that particular command that you are writing you give the target Otis 8080 okay if you have something else different port I'm not sure whether that port is accessible or not but make sure that you provided dat so I'm just going to execute this and once the deployment actually happens now you can see that service or insurance app is excerpt exposed this will probably take some time guys how we can see you can see the way I am just going to type one someone which is called as Cuba net Kubek tell get Cupid cupid tell get services if I execute this you'll be able to see that the insurance app this is basically my application the load balancer the type is load balancer the external IP spending that basically means this executed command is still taking some time to get exposed okay again I will check after some time you can see over here still the external IP spending I am just going to clear the screen quickly and again once more execute the same command probably it will still take some time let's see how much time it may take but this external IP we can actually use it okay we can use it to access the application understand we have gone step by step okay this was the final step and we need to expose you know to a specific IP based on the DR IP that we have actually provided so again let me just write it yes now you can see there's an external IP now if you really want to check this external IP you can see that it is getting executed perfectly now you have written provide your age your different categories your suppose I'm just providing some values and once I predict it you can see that this is the value that will be the accepted bill value okay with respect to the insurance bill that is what we are doing over here right we are submitting it now other way is that you can also write curl you can also check it from here by putting a curl command and giving on to this particular IP so which I'm popping it over here and pasting it over here and once executed you will be able to see the successful response that you are getting of the home page right so yes this wasn't shot again let me just revise all the steps that we had actually followed by seeing this block again guys thank you to Moyes le and he really wanted to share with the entire data science community so the first step once the application is built I'm not just going to go through the application because I have uploaded a lot of videos we understood about Google queue Burnett's okay and the Google cabinets engine so the first step what we did is that we cloned through the git git clone then we set up the environment variable then we build the docker image by using this command and GCR dot IO is basically my Google container a deposit fee this is the path where my image is actually present and this is basically my tag name v1 after this I am just writing docker images to see all the images itself we need to configure the docker that this is specifically for the Google container container repository or then we are actually pushing pushing our image to GCR okay then which is not Google container repository instead it is a registry okay then we are setting our project ID and computers own then after that you can see that we are creating the clusters make sure that you provide one guys don't provide too you'll be getting some kind of error in the free version then once you do that you just deploy the application into the GCR okay sorry not into the jeez into the gk cluster that is google cuban it engine cluster where you have actually created it then finally you have to explosion will please make sure that you see the docker file in order to do that and finally when you see get services you'll be able to see your external IP and once click on the external IP you'll be able to see the webpage that is coming so this shouldn't shot was all the steps that we had actually followed and finally we were able to get this again just try by yourself and try to see that whether you do it or not so yeah it's cuz this was all about this particular video I hope you liked it please do subscribe the channel if you an already smells you all in the next video have a great day thank you one
Info
Channel: Krish Naik
Views: 49,775
Rating: undefined out of 5
Keywords: data science tutorial javatpoint, data science tutorial python, data science tutorial online free, python data science tutorial pdf, python data science tutorial point pdf, what is data science, data science tutorial tutorials point, data science course, nlp tutorial python, natural language processing python, natural language processing examples, natural language processing projects in python, natural language processing techniques
Id: lAAeJDcoHKY
Channel Id: undefined
Length: 30min 50sec (1850 seconds)
Published: Tue Jun 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.