Colab Manual


By Prof. Seungchul Lee
http://iai.postech.ac.kr/
Industrial AI Lab at POSTECH

Table of Contents

1. Overview

  • Colaboratory, or "Colab" for short, allows you to execute your Python code in internet browser with below advantages
    • Free access to GPU(Tesla K80)
    • Zero configuration
    • Integration with Google Drive
  • In this chapter, you will learn three things:
    • Install colab on your chrome
    • Integration with google drive

2. Requirements

  • Computer Spec
    • It can be operated regardless of your computer specs
  • Installation
    • You don't need to install Python or Anaconda
  • Only needed
    • Google Account + Wifi

3. Colab Installation

[1] Log in with your Google ID and search for google colab



[2] Click "New Notebook"


[3] Then a screen,similiar to a Jupyter Notebook,could be seen

[4] Change your file name to what you want.



[5] If you select "+code" button, and you can implement your code in two ways: clicking arrow shape or just pressing "ctrl+enter" on your keyboard



[6] you can also delete your cell pressing ctrl+m+d

4. GPU

[1] If you change your setting to [Runtime]$\Rightarrow$ [Change runtime type]$\Rightarrow$ [Hardward accelerator]$\Rightarrow$[None]$\Rightarrow$[GPU] , you can use a Tesla K80 GPU even if you don't have a GPU assigned to your laptop





[2] Enter "!nvidia-smi" into the cell and run it, you can check the GPU and CUDA version



5. Google Drive

[1] If you click the third folder from the bottom on the left bar, three types of file icon, folder icon and drive icon are displayed. Click on the drive icon on the far right


[2] Select "Connect to Google Drive"


[3] You can check that the drive has been uploaded to Colab


[4] You can also uplaod google drive on to your Colab using this code
from google.colab import drive
drive.mount('/content/drive')

6. Runtime

When you use Colab, you will see a lot of phrases like "Runtime Connection Exceeded". The actual runtime that Google provided is for about 12 hours, however, if they are no activity for about 30 minutes, it would be shut down. If you are really annoyed about it, you can also find a solution about it by going to the hyperlink below.
https://medium.com/@shivamrawat_756/how-to-prevent-google-colab-from-disconnecting-717b88a128c0

In [1]:
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')