Getting Started with Google Colab
I have been using Jupyter Notebooks for a while for my projects and so I decided to start using Google Colab just to get used to the platform. As I was trying to get started I found myself struggling with some basic things. Where does my file go when I just hit save? How to save the notebook on GitHub and then push any subsequent changes to the notebook?
This is what I am going to demonstrate on this blog post and I hope it helps someone out there that is just getting started with the platform.
Google Colab is a free cloud service that allows users to “write and execute python” without having to do any configurations; in addition, it gives access to free GPU.
To get started, on your browser, just type “Colab” and click on “Google Colab”. Or you can just click here. You should be able to see the image below (Figure 1). You can click on Google Drive and choose “NEW NOTEBOOK” to start working on a new notebook or you can choose an existing notebook from your Google Drive. You can also choose “CANCEL”.
If you choose to CANCEL, you can create a new Notebook by going to file and choosing “New notebook” as shown in Figure 2. This creates a new notebook that is going to be saved on your Google Drive.
If you want to save your notebooks on a new GitHub repository, go to your GitHub and create a new repository.
Then, on your notebook click on File and then “Save a copy in GitHub” (Figure 3).
Look for the name of the repository under “Repository”. If for Branch you get “Could not fetch branches” (Figure 4), you will not be able to save the file.
The quickest way I found to solve this problem was to first create a README file on git (Figure 5).
Once you do that, you should be able to start pushing your changes to GitHub (Figure 6).
Finally, if for your project you want to use GPU, on Colab, click on “Runtime” and choose “Change runtime type”. Choose “GPU” for the Hardware accelerator.
I hope this is helpful!
References: