‫Awesome.
‫So now if you print out this little line here, it should print out something like this HTF version.
‫I'm using 2.1.0, but if yours is two point something above, that should be fine.
‫Unless TensorFlow.
‫I've broken all the code that we're working on here, which is unlikely.
‫But I should have put up in here getting our workspace ready.
‫I should have put out what we're actually going to do.
‫So we need to import TensorFlow two point X, we've done that.
‫We can put a little check mark beside that.
‫I wonder if we can.
‫I'm going to put an emoji next to that.
‫There we go.
‫Green tick.
‫Wonderful.
‫We need to import TensorFlow hub and we also need to make sure we're using a GPU.
‫Remember, in the introductory lecture, we said we're going to need a GPU because when we're working
‫with unstructured data, oftentimes the patterns are a lot more vast.
‫And running a neural network, a special kind of machine learning model, takes a lot more compute power
‫than what a traditional machine learning model like something like a random forest we've ran in the
‫past has or at least in our case, because we're dealing with a lot more data this time.
‫We've got 10,000 plus images, nearly a gigabyte worth of data.
‫So whereas our previous SVS were only a couple of megabytes or kilobytes even less than that.
‫So we've imported TensorFlow two point X now we need to figure out how to import TensorFlow hub, okay.
‫And make sure we're using a GPU.
‫And now if we come back, the reason why we need TensorFlow hub is because this is where we're going
‫to pick our model from.
‫And the reason why we need TensorFlow is, of course, to build this whole pipeline and to get our data
‫into tenses.
‫So we're still getting our workspace ready.
‫Let's import TensorFlow hub.
‫So we'll put here, I'll write a little comment, import necessary tools.
‫We could import a few more that we'll use, but we might import them as we go.
‫But I just want to make these two known right at the top because these are the main ones of this entire
‫project.
‫So import TensorFlow hub, it's already installed in CoLab, which is beautiful.
‫Another great reason for using CoLab as Hub.
‫That's the traditional TensorFlow hub way of importing it.
‫Then we can also go print.
‫TF.
‫Hub version.
‫Same Y.
‫Hub.
‫Underscore.
‫Version.
‫Underscore, underscore.
‫Wonderful.
‫And then we're going to write a little line here now that we've imported TensorFlow, which will help
‫us check if there's a GPU available.
‫Because TensorFlow, what it does is it allows us to write Python code, which gets executed on a GPU.
‫So TensorFlow underneath all the TensorFlow code that we write calls another library which allows our
‫code to be run on a GPU in turn make really fast numerical calculations.
‫So let's go here.
‫Check for GPU availability.
‫And now another reason why we're using CoLab is because Google kindly provide free GPU access to us.
‫So my laptop, if I was to try to run this project on my laptop, it probably it would probably burn
‫out before it could even figure it out.
‫It could run for days on end.
‫But what we'll see as we eventually get to it, because we're going to be using a GPU, it runs a lot
‫faster.
‫And even then it's going to take half an hour or so.
‫We're getting out ahead of ourselves.
‫Then you'll come on.
‫Let's just check if the GPU is available.
‫So I'll show you a little bit of code you can use.
‫It's TensorFlow based to see if a GPU is available.
‫Now I'm going to write out a little success message because I love seeing that we have access to a GPU.
‫And you should to to be honest, because this is what's caused the deep learning revolution is the access
‫to GPUs.
‫And now what is this little function doing here?
‫Well, I want you to try and imagine what is it doing?
‫We're accessing TensorFlow.
‫TensorFlow is configuration and it's going to list the physical devices.
‫And that literally means what you might think.
‫It means what physical devices are powering this python three Google compute engine back end so we can
‫say ram they're gigabytes 1.11 and we got disk.
‫What else is there?
‫We are most concerned with the CPU, so we're just going to pass it.
‫The GPU string.
‫This is people who have written TensorFlow have had this problem before and they've gone let's just
‫make this easier to check if we've got a GPU ls not available.
‫Unhappy face.
‫So we run this.
‫Let's see what happens.
‫Oh, well, we do have TensorFlow Hub.
‫That's beautiful.
‫We got CPU not available.
‫And you might be asking, what is TensorFlow hub?
‫Well, this is where I'd encourage you to do your own research.
‫What is I'm going to go through it in a moment.
‫But you go.
‫What is TensorFlow hub?
‫Search that up.
‫Have a quick read if you're if you want to check it out.
‫But don't worry about that for now.
‫What we're focused on is getting a GPU available.
‫Hmm.
‫All right.
‫How do we do that?
‫Well, let's figure it out.
‫So if we go to runtime.
‫We can go to change runtime time.
‫Now again, this is our runtime here.
‫So there's a lot of things that look a bit complicated.
‫So connect to our host hosted runtime.
‫Okay, let's go.
‫Runtime change.
‫Runtime type.
‫This is how we get access to a GPU.
‫We've got runtime type Python three.
‫I'm recording this in post 2020, so Python two is no longer supported.
‫So always Python three.
‫That means Python two just won't be getting any more updates.
‫It'll probably still run for a while.
‫Hardware, accelerator.
‫Let's click this.
‫What does this mean?
‫Let's zoom in.
‫What type of GPUs are available in CoLab.
‫Beautiful.
‫So this is necessary for CoLab.
‫The GPUs available in CoLab often include NVIDIA cards, HT fours, p fours and P 100.
‫Again, if you're curious what these are, google nvidia 80, nvidia T4, Nvidia P4, Nvidia P 100.
‫Long story short is that these are different types of NVIDIA GPUs.
‫Nvidia is a GPU maker like Intel is a CPU maker, and these are just different models of chips.
‫So let's go in here.
‫We're going to choose a CPU.
‫You can also choose CPU, but we're focused on GPU for now.
‫TPU requires a little bit more set up with the code, but that could be again, something that you could
‫look up yourself.
‫How to use a TPU in colab.
‫That's a bit of a rabbit hole you can get down.
‫But let's go GPU.
‫Click Save.
‫Again to do that runtime change runtime type GPU and you'll see, oh we've remounted Google Drive and
‫this is changing.
‫Look at that.
‫Oh yeah.
‫Connected to Python three, Google Compute engine back end CPU.
‫Wonderful.
‫So.
‫What we have to do now is because we've just restarted our runtime, we're going to have to if you've
‫already got access to TensorFlow 2.0, like if the output of this cell is TensorFlow 2.0, you can just
‫rerun this cell.
‫But because I don't have TensorFlow 2.0 by default, I'm going to have to rerun this cell here.
‫So we run this TensorFlow two point x selected now.
‫Fingers crossed if we have a GPU available, meaning super fast numerical computing.
‫This little output message should change because this little piece of code is going to check to see
‫if a GPU is available, which it looks like it is.
‫Let's run this.
‫Oh, yes.
‫Woo hoo!
‫So now we have a GPU available, we have TensorFlow available and we have TensorFlow hub.
‫Let's go have a look at our keynote where we're up to.
‫We've done this.
‫This is what we've done, except we've built it all up in CoLab.
‫So now we're ready to actually go to our workflow.
‫I should have put step zero on here is get our workspace ready.
‫But this is really exciting.
‫We can now get our data ready by turning it into tenses.
‫So come back to our notebook, make sure if you run this cell you've got access to a CPU because the
‫code we run later on will utilize a GPU and make sure your TensorFlow version is higher than two point
‫x and your hub version.
‫It doesn't really matter, but if it's 0.7 or above, that's a good thing.
‫So I'll see you in the next video.
‫Let's start figuring out how to get our data ready.