How to Deploy a Machine Learning Model to Google Cloud for 20% Software Engineers (CS329s tutorial)

Sdílet
Vložit
  • čas přidán 1. 08. 2024
  • It's time to reveal the magician's secrets behind deploying machine learning models! In this tutorial, I go through an example machine learning deployment scenario using Google Cloud and an image recognition app called Food Vision 🍔👁.
    Get all the code on GitHub - github.com/mrdbourke/cs329s-m...
    Slides - github.com/mrdbourke/cs329s-m...
    Full CS329s syllabus - stanford-cs329s.github.io/ind...
    Learn ML (my beginner-friendly ML course) - dbourke.link/mlcourse
    Connect elsewhere:
    Web - www.mrdbourke.com
    Get email updates on my work - www.mrdbourke.com/newsletter
    Timestamps:
    0:00 - Intro/hello
    1:42 - Presentation start (what we’re going to cover)
    6:00 - Food Vision 🍔👁 (the app we’re building) recipe
    11:16 - The end goal we’re working towards (data flywheel)
    13:07 - The data flywheel: the holy grail of ML apps
    14:57 - Tesla’s data flywheel
    17:02 - Food Vision’s data flywheel
    18:24 - Deploying a model on the cloud outline
    21:14 - Steps we’re going to go through to deploy our app
    27:06 - Question: “How do you identify hard samples in your data?”
    37:53 - Creating a bucket on Google Storage
    45:51 - Uploading to Google Storage from Google Colab
    48:02 - Deploying a model to AI Platform
    52:50 - Creating an AI Platform Prediction version
    58:10 - Creating a Service Account to access our model on Google Cloud
    1:02:32 - Authenticating our app with our private Service Account key
    1:09:19 - What happens when we run make gcloud-deploy
    1:11:27 - Problems you’ll run into when deploying your models
    1:20:12 - Extensions you could perform on this tutorial
    1:20:49 - Part 2 start (tutorial overtime)
    1:28:43 - Dealing with different data shapes
    1:32:35 - An error you might run into when using the example app (3 total models deployed)
    1:33:20 - Dealing with data size restrictions
    1:38:48 - Stepping through the make gcloud-deploy command
    1:51:00 - Summary and wrap up
    #machinelearning
  • Věda a technologie

Komentáře • 126

  • @mrdbourke
    @mrdbourke  Před 3 lety +35

    **Update (20 May 2021):** After Google's recent I/O event, AI Platform has now changed its name to Vertex AI, so some of the terminology/steps on the GCP platform may be named differently/have slightly different steps, but the main principles of deploying a model should remain.
    Happy Valentine's Day team ❤️! Sending love to you all. Happy Machine Learning!

    • @tirthpatel6436
      @tirthpatel6436 Před 2 lety +1

      Can you please provide the required steps for VERTEX AI?

    • @abhishek9721452503
      @abhishek9721452503 Před rokem

      Hi Daniel ,I am trying to deploy the code on the Vertex AI,in this they have changed the format and specification of make_prediction() function which you used in video. Now when I am passing image as an instance to this new function I am getting error. Can you please update your code in the github for this entire deployment where you use the new VertexAI specifications?

  • @sayakpaul3152
    @sayakpaul3152 Před 2 lety +5

    Your honesty is infectious. The way you made your (Eng : ML) ratio clear at the beginning speaks volumes about it. Thanks, Daniel. Amazing work!

  • @bhaveshrikame3888
    @bhaveshrikame3888 Před 2 lety +1

    one of the best in the business thanks daniel for this wonderful tutorial, i always had problem about whole lifecycle of model on cloud, but you cleared all my doubts

  • @bob1234568790
    @bob1234568790 Před 3 lety

    thanks for coming to our class!!! my favorite guest lecture so far!!

  • @ramonsantiago4573
    @ramonsantiago4573 Před 2 lety +1

    I would absolutely love for you to make a course about the software needed to deploy models. I'm having to learn bits and pieces from everywhere...

  • @yashpatel-wk7td
    @yashpatel-wk7td Před 3 lety +9

    The Content you provide in this Tutorials is my Valentine ❤️...!!! Thank you for posting top notch content..!!!

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      Woohoo! Happy Valentine’s Day Yash ❤️🌹

  • @danielcasadoherraez4
    @danielcasadoherraez4 Před 2 lety +1

    Incredible tutorial!! Thanks so much :D

  • @abhishekbhatia651
    @abhishekbhatia651 Před 2 lety

    You are such an inspiration Daniel!

  • @yasminebaroud3965
    @yasminebaroud3965 Před 11 měsíci

    thank you, you are the best person for teaching every things

  • @jorgefelipegaviriafierro705

    Thank you so much for this, really great content :)

  • @SuperNova23333
    @SuperNova23333 Před 3 lety +1

    I just finished ZTM machine Learning course on UDemy. Thank you for all your hard work.

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Massive effort Super! Congratulations on finishing!

  • @tjv9qh
    @tjv9qh Před 3 lety +4

    I almost never comment on CZcams videos, but here I wanted to break that trend in order to kindly thank you for this tutorial. This was a MAJOR lifesaver for me in my SYS6016 (Machine Learning) course at UVA. Absolutely awesome stuff.

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      thank you! I appreciate your comment and you breaking your trend to leave it :)

  • @timoose3960
    @timoose3960 Před 3 lety +1

    Great follow along tutorial! Keep it up!

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you Timoose! Plenty more to come

  • @shoaibsh2872
    @shoaibsh2872 Před 3 lety

    You read mind, I am sure about it. You have the power of telepathy. I was just searching about this topic an here you upload it right that moment. Thank you very much for the tutorial

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      Great timing hahaha! Enjoy Shoaib!

  • @knowhrishi
    @knowhrishi Před 3 lety

    Thanks! That was awesome content! Which you always have! Love from India!

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you Hrishikesh! Love form Australia!

  • @yogeshhasabe4931
    @yogeshhasabe4931 Před 3 lety

    A Great Gift for the people whose valentine is Machine Learning...!!
    Another Masterpiece from 'the Daniel Bourke' :)

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      Happy Valentines Day Yogesh! 🌹

  • @ayushchakraborty4406
    @ayushchakraborty4406 Před 3 lety

    Thank you for posting such amazing content, so Informative!!!!!😀😀

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      You’re welcome Ayush! Enjoy legend!

  • @aritxatroyano2983
    @aritxatroyano2983 Před 3 lety

    Great video Daniel. Keep Going!!!

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you Aritxa! I appreciate it

  • @cristophernimatuj4220
    @cristophernimatuj4220 Před 3 lety

    Big fan of your work. I hope to get to your level one day.

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you Cristopher! All the best legend

  • @CortiPum
    @CortiPum Před 3 lety +1

    Hi! First of all i found this super interesting. I´m doing something similar and this really helps me a lot. Ty !

  • @user-or7ji5hv8y
    @user-or7ji5hv8y Před 3 lety

    Thanks for sharing the video with the community. very useful actually.

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you! Stoked you enjoyed

  • @mohamedabdelrehem7698
    @mohamedabdelrehem7698 Před 3 lety

    i am bored on the train going home so i found your video best 2 hours of my life

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      Glad you’re enjoying it Mohamed!

  • @choc3732
    @choc3732 Před 3 lety +1

    I had to do this for my college ML project last semester. Could really have done with this video....

  • @pinakinchaudhari95
    @pinakinchaudhari95 Před 3 lety +3

    Man this is just what I have started, wow

  • @hamzakivideo
    @hamzakivideo Před 3 lety

    Thank you sharing this! Quick question, how should I run tensorboard; I ran %tensorboard --logdir logs/scalar - but I keep getting an error of dataset not active

  • @phonethiriyadana
    @phonethiriyadana Před 3 lety +1

    wow.. this is great. was just looking for ML deployment resources 😊 could be a next step of your ML course.

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you! The models we used in this tutorial are built in the upcoming course

    • @phonethiriyadana
      @phonethiriyadana Před 3 lety

      @@mrdbourke wo hoo.. can't wait :D

  • @Amandeep-kx8jl
    @Amandeep-kx8jl Před 3 lety

    try to do videos on kaggle problems and contests. that would be very helpful

  • @hemanthkotagiri8865
    @hemanthkotagiri8865 Před 3 lety +1

    In india, when you say "I'm a driver" some people look down on you. As apposed to that, I absolutely love the fact that you've mentioned you were #4.94 rated uber driver to the seemingly most intellectual minds of Stanford. That's being true of what you are. I like it. I'm learning a lot from you, Danny. Thank you!

    • @mrdbourke
      @mrdbourke  Před 3 lety +4

      Thank you Hemanth, I appreciate it!
      As for the “driver”, I treat the doorman with as much respect as the CEO. There’s opportunity to bring value to others no matter what your role.

    • @hemanthkotagiri8865
      @hemanthkotagiri8865 Před 3 lety

      @@mrdbourke I totally agree with you on that. He/She is as human as I am and deserve respect.

  • @dcr7417
    @dcr7417 Před rokem +2

    Hi @Daniel Bourke thanks for this lesson! I'm looking forward to doing this project but am getting the following error:
    Collecting requests==2.25.1
    Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)
    ERROR: Could not find a version that satisfies the requirement tensorflow==2.4.1 (from versions: none)
    ERROR: No matching distribution found for tensorflow==2.4.1
    Has anyone experienced this? My Python version in the virtual environment is 3.10.6

  • @siddharthtiwari01
    @siddharthtiwari01 Před 3 lety

    Hi @Daniel Bourke, Thank you so much I learnt a lot. I noticed that the training code that you provided is not using GPU when I was training it myself on colab and on my PC . I wonder why? Any ideas?

    • @mrdbourke
      @mrdbourke  Před 3 lety

      You can switch to using GPU in Colab’s Runtime menu (when I trained the models I definitely used a GPU)

  • @zeinfahrozi1733
    @zeinfahrozi1733 Před 2 lety

    an error occured when trying to save model1 i think this is because using tf 2.7.0
    KeyError: "Failed to add concrete function 'b'__inference_model_layer_call_fn_51753'' to object-based SavedModel as it captures tensor which is unsupported or not reachable from root. One reason could be that a stateful object or a variable that the function depends on is not assigned to an attribute of the serialized trackable object (see SaveTest.test_captures_unreachable_variable)."

  • @mkalime
    @mkalime Před 2 lety

    Hi Daniel and many thanks for the effort! Great video!
    Am I wrong in the following? (This is from the part where you use the app locally with the model deployed on GCP) When you created the model version, right at the bottom of the setup page (57:02), there was the option to choose a service account which you ended up not specifying at that point (neither later?). Then you created a service account, generated a key for it and saved it locally for the app to use when making a request. I did the same and managed to get it worked but only when I don't explicitly specify the sa. When I do specify the sa (during model version creation) I get "Failed to add IAM policy binding" error and model is not deployed. By playing around, I figured that the credentials for the specific sa don't even matter, GCP apparently has some default sa that it uses when one doesn't specify a custom sa.

    • @mrdbourke
      @mrdbourke  Před 2 lety

      Hmmm, I’m not 100% sure of what’s going on here. In my experience, I’ve had to make a SA for each specific service, or adjust an existing one for a new service - I thought GCP by default made all SA’s have as little permissions as possible, hence the requirement for creation. Perhaps I’m wrong or it’s been changed?

  • @scientificthinking9257
    @scientificthinking9257 Před 2 lety +1

    nice one

  • @benxneo
    @benxneo Před 3 lety

    awesome video Daniel! In your opinion, should someone getting into data engineering learn GCP or AWS first?

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      Thank you Benedict! As for AWS vs GCP, I’d choose either, they both have similar offerings (just with different names for the services). AWS is probably more commonly used at different companies though

  • @sonphamtrung1284
    @sonphamtrung1284 Před 3 lety

    That's great video. Thanks you.
    ---From Viet Nam with love---

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Stoked you enjoyed! From Brisbane with love!

  • @avinashreddyc8271
    @avinashreddyc8271 Před 8 měsíci

    Very good video , can i ask which clod platform is better gcp or aws or azure , gcp looks better in your tuitorial though

    • @mrdbourke
      @mrdbourke  Před 8 měsíci

      They all have similar offerings
      However, my experience is mostly with Google cloud
      So I went with them

  • @pengdu7751
    @pengdu7751 Před 3 lety

    great talk and demo! how does Google AI compare with other options such as AWS SageMaker?

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Thank you! I haven’t compared Google AI and SageMaker but I imagine they’re similar

  • @nicholai9266
    @nicholai9266 Před 3 lety

    Is there any diff. between ML and AI engineers, does AI engineer(job role) really exist?

  • @buffetbar8231
    @buffetbar8231 Před rokem

    How to decide the number of hidden layers and nodes in a hidden layer?

  • @krumroar1572
    @krumroar1572 Před 2 lety

    Nice ...go!

  • @kesavae9552
    @kesavae9552 Před 3 lety

    3:41 I loved the way how he used kite image for small apps and plane for large apps 😂

  • @shubhammuramkar9316
    @shubhammuramkar9316 Před rokem

    make gcloud-deploy is not working timestam 1:09:32. says "zsh: command not found: makefile"

  • @fiqiamali
    @fiqiamali Před 2 lety

    Hey daniel, when I run model 1,2,3 on google collab, why it cannot be save like you did. Mine tell there is an error

    • @mrdbourke
      @mrdbourke  Před 2 lety

      Yo yo, what error are you getting? Any chance you could post it on the Github for the tutorial (as an issue)?

  • @RisuAnetto
    @RisuAnetto Před 3 lety

    How can I use Pytorch model? Do I need a custom container? What container is useful for a BERT model?

    • @mrdbourke
      @mrdbourke  Před 3 lety

      You can definitely use PyTorch but it requires a couple different steps, check the documentation on AI Platform for more

  • @002_aarishalam8
    @002_aarishalam8 Před 3 lety +1

    converting floating points to int16 is giving weird results.

  • @alikafaei102
    @alikafaei102 Před rokem

    Love the aussie accent bo

  • @alexchan5643
    @alexchan5643 Před 3 lety +1

    47:20 my exact reaction whenever anything goes right

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Hahaha I wanted to make it as real as possible

  • @tarekhosny8166
    @tarekhosny8166 Před 3 lety +1

    Daniel, Do I need to memorize the mathematical equations of machine learning algorithms or just understand the math behind them and what they do?

    • @advait7802
      @advait7802 Před 3 lety +1

      You need to just understand the math, no need to memorize them, because to do anything you'll be using tensorflow or any framework which will handle the math.
      You can actually skip the math (not recommended) and still be fine. The math is just so that you understand what's going under the hood.
      The math gets complex as you move ahead, so if you skip a bit of the end it's still fine as long as you understand all the basics.
      Although if you plan on doing deep research and figuring out new techniques that aid the current ML process, learning math is really really important.

    • @tarekhosny8166
      @tarekhosny8166 Před 3 lety

      @@advait7802 Thanks for the advice.

  • @deekshithadp9545
    @deekshithadp9545 Před 3 lety

    Hey Daniel,
    First of all thank you so so much for providing such informative content!! I sincerely appreciate all your efforts and hardwork.
    By watching this video, I have gathered plenty of information. I am going to continue watching all your videos in the coming days!!
    I am having few doubts. I will be greatful to you if you could guide me and suggest me your thoughts on this.
    1. At 1:17:56 you mentioned about one class containing 11 classes while another class with random non-food images. What I understand from here is that you have got 2 main classes, one of them having 11 different classes, which makes it binary classification. How can I train this kind of image directory?
    I am having similar use case; I want to classify oral and non-oral images, where a non-oral class contaiins any random images of different categories.
    Could you please help me with this problem? How can classify my images?
    2. Could you please let me what are the requirements/preparations that I need beforehand to deploy my trained model into GCP to use it in APP development?
    Thank you very much once again for such a valuable content!! ❤️ ❤️ ❤️
    Keep rising and surprising people with more videos!!!!!

  • @danielsilva3383
    @danielsilva3383 Před 3 lety

    Hello Daniel! I saw that you have a big interest in sports and even a degree. I am also passionate about sports and ML and if you don't mind I would like to ask some question. Do you think that there are good applications of ML in sports? Have you ever done anything related to that? How much expertise would it take? Do you think that building an app like SwingVision (tennis tracking app for iOS) is possible for one person? And what about sports analytics? Finally, could I make a Saas out of that? Have you ever done a Saas (of any type)? Thank you 😉☺️

    • @mrdbourke
      @mrdbourke  Před 3 lety

      SwingVision is definitely possible, check out something like “iOS pose detection” and let your imagination run
      I haven’t personally built a Saas but stay tuned
      Saas in sports would be same premise as other Saas though: find a problem people have, solve it with software, sell it

  • @talhakhursheed2467
    @talhakhursheed2467 Před 3 lety

    How much will it cost me to deploy my ML model on GCP?

  • @prod.kashkari3075
    @prod.kashkari3075 Před 3 lety

    Is pytorch equally as good for deployment as tensorflow is?

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Yes, however I think currently TensorFlow edges it out with features (eg mobile deployment)

  • @tsogoobayartsogt5653
    @tsogoobayartsogt5653 Před 3 lety

    44:28 This is one way, but if you already connected with your Google Drive, then you'd be able to use GCP for that particular account (which I think a lot more easier)

  • @crehenge2386
    @crehenge2386 Před 2 lety

    So if I do something, I will have done it... wow, that's deep

  • @dhruvmewada4303
    @dhruvmewada4303 Před 3 lety

    shuold i switch to linux ubantu for machinelearning or windows will work fine'

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Windows works fine, however, most cloud systems run some form of Linux (Ubuntu etc)

  • @ameenbello4500
    @ameenbello4500 Před 3 lety

    Does anyone have the link to his twitch channel, can't seem to fnd it anywhere

  • @alpozen5347
    @alpozen5347 Před 3 lety

    hey man im just curious, why did u not study CS since u seem to be doing it as a career now cuz i remember u mentioned u studied nutrition and sports

    • @mrdbourke
      @mrdbourke  Před 3 lety

      I didn’t even know CS was an option when I started university. But I’m glad I studied something else because now I’ve still got plenty to learn

  • @shreyasingla9307
    @shreyasingla9307 Před 3 lety +1

    👍🏻👍🏻

  • @reazonsraj
    @reazonsraj Před 3 lety

    Dan mate are u sing the apple m1 or just a regular mac cus my m1 is having issues installing all this shit

    • @mrdbourke
      @mrdbourke  Před 3 lety

      I used a non-M1 Mac for this video (MacBook Pro 16-inch, i9)

    • @reazonsraj
      @reazonsraj Před 3 lety

      @@mrdbourkei can't install all this on my m1 so switched to windows btw loved the zero to mastery on tensorflow any way u can do a tutorial on deployment a little bit more detailed than this cs class plzz mate we are asking for it for a while after we bought the course cheers mate.

  • @MrBemnet1
    @MrBemnet1 Před 3 lety

    can you shrink the video length for the future? It is too long ..

  • @markgacoka9704
    @markgacoka9704 Před 3 lety +1

    While other people are on Valentine's, I'm busy trying to deploy ml models 😂😂

  • @programmerrdai
    @programmerrdai Před 3 lety

    How can I join the course?

    • @mrdbourke
      @mrdbourke  Před 3 lety

      Full details on the course here: stanford-cs329s.github.io/

  • @nishchaysingh5980
    @nishchaysingh5980 Před 3 lety

    Excuse me Sir. I know that you have earned the Tensor Flow Developer Certificate . Congratulations on that.
    I am also following your instructions that you gave about that Course Course Of Tensor Flow. Unfortunately before that I referred to random video on CZcams and tried to use some basic commands of Tensor Flow on Jupyter notebook but a lot of problem start coming with the version . Mostly about "....
    . some command could not be found in module" .
    Also tried to downgrade the version to 1.4 but not much happened. It had became a headache .
    Can you give some help so that these things do not restrict me from implementing commands while doing the Coursera Course Of Tensor flow. 🙏🙏🙏🙏

    • @mrdbourke
      @mrdbourke  Před 3 lety

      If you’re running into troubles with Coursera’s notebooks, I’d use Colab and practice writing as much TensorFlow code as possible, you will learn it

    • @kolla_teja
      @kolla_teja Před 3 lety

      I would recommend don't go for lower version check once on tensorflow official certification examination page. you can get to know which version you are really want to use and on which version your exam based. happy learning!

  • @jithendrayenugula7137
    @jithendrayenugula7137 Před 3 lety

    You using Google instead of duckduckgo? 😐 It's from your videos I started using duckduckgo 😅
    Anyway great tutorial...Thanks for making it public🤟

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      I use both! And thank you for the kind words

  • @DiegoRivera-eu4uh
    @DiegoRivera-eu4uh Před 2 lety

    Chicken curry?!! haha

  • @danielsilva3383
    @danielsilva3383 Před 3 lety +1

    Hello, Great Video! What do you do for a living? Does this channel pays for your bills? Could you make a video on how much you earn from YT and your courses, please? Thank you

    • @mrdbourke
      @mrdbourke  Před 3 lety +1

      Hey Daniel, thank you for the kind words. This article sheds a bit more on how I make money: www.mrdbourke.com/running-a-business-from-a-bedroom-11-months-in/

    • @danielsilva3383
      @danielsilva3383 Před 3 lety

      @@mrdbourke Thank you

  • @smerlinger
    @smerlinger Před 3 lety

    How old are you?? Curious to measure your age and my age and where i'm at in my career!

  • @jackbauer322
    @jackbauer322 Před 3 lety

    Not pizza :)

  • @user-zo4mu6bp6w
    @user-zo4mu6bp6w Před 5 měsíci

    Hey Man!
    You streamed such a great tutorial for free?
    Thank you Sir for your community services!