Google Colaboratory

Colaboratory is a Google research project created to help disseminate machine learning education and research. It’s a Jupyter notebook environment that requires no setup to use and runs entirely in the cloud. This means that as long as you have a Google account, you can freely train your models on a K80 GPU.

When you log in and connect to the Colaboratory runtime, you will get your own virtual machine with a K80 GPU (not always entirely yours, read below) and a Jupyter notebook environment. You can use it to your heart’s content for up to 12 hours. Or until you close your browser window. Be warned, sometimes the runtime can disconnect randomly.

Tips and tricks

If you start a line in Jupyter Notebook with ‘!’, the line will execute as a command on the virtual machine supporting the runtime. Example: !pwd

Getting your own GPU2:

So, if you want to use Google Colaboratory you should be aware that you may end up being not so lucky and share a K80 with somebody else. The main disadvantage of this is that you won’t have the full RAM of the GPU available and Tensorflow might throw out of resources exceptions. To see how much ram you have available run this script.

If you see RAM usage, that means that you are sharing the card with someone. Since by default Tensorflow allocates almost 100% of the GPU’s memory this is a problem. To get a new instance and a new chance to get you own GPU, run the following command in a cell:

!kill -9 -1

Then wait 30-60 seconds and reconnect and check with the above script if you got your own GPU.