TensorFlow Dev Summit 2020: Top 10 Tricks for TensorFlow and Google Colab Users

In this piece, we’ll highlight some of the tips and tricks mentioned during this year’s TF summit. Specifically, these tips will help you in getting the best out of Google’s Colab.



Google’s Colab is a truly innovative product for machine learning. It enables machine engineers to run Notebooks and easily share them with colleagues. Another key advantage is access to GPUs and TPUs.

In this piece, we’ll highlight some of the tips and tricks mentioned during this year’s TF summit. Specifically, these tips will help you in getting the best out of Google’s Colab.

 

10. Specify TensorFlow version

 
Very soon, the default TF version in Colab will be TF 2. What this means is that if you have Notebooks running in TF 1, they will probably fail. In order to ensure that your code doesn’t break, it’s recommended that you specify the TF version in all your Notebooks. This way, if the default version changes, your Notebooks still work.

 

9. Use TensorBoard

 
Google Colab provides support for TensorBoard by default. This is a great tool for visualizing the performance of your model. Use it!

 

8. Train TFLite Models on Colab

 
When building mobile machine learning models, you can take advantage of Colab’s resources to train your models. The alternative to this is training your model using other expensive cloud solutions or on your laptop, which might not have the needed compute power.

 

7. Use TPUs

 
Should you need more powerful processing for your model, then change your default runtime to the TPU. However, you should only use TPUs when you really need them, because their availability is on a limited basis, given how resource-intensive they are.

 

6. Use Local Runtimes

 
In the event that you have your own powerful hardware accelerator, then Colab allows you to connect to it. Just click on the connect drop down and select your preferred runtime.

 

5. Use Colab Scratchpad

 
Sometimes you might find yourself in a situation where you want to test things out quickly. Instead of creating a new Notebook that you don’t intend to save on your drive, you can use an empty Notebook that doesn’t save to your drive.

Machine learning is rapidly moving closer to where data is collected — edge devices. Subscribe to the Fritz AI Newsletter to learn more about this transition and how it can help scale your business.

 

4. Copy Data to Colabs VM

 
In the interest of speeding up the loading of data, it’s recommended that you copy your data files into Colab’s VM instead of loading them from elsewhere.

 

3. Check Your Ram and Resource Limits

 
Since Colab’s resources are free, it means that they are not guaranteed. Therefore, keep your eye on the RAM and Disk usage to ensure that you don’t run out of resources.

 

2. Close Tabs when Done

 
Closing tabs when done ensures that you disconnect from the VM and therefore save resources.

 

1. Use GPUs only when Needed

 
Since these resources are subject to restriction, save your GPU usage for when you really need it. However, if you need to work with Colab without the restrictions of the free version, you can check out the pro version.

I hope that you will find these Colab tips and tricks for TensorFlow helpful.

For a dive into other TensorFlow news coming out of the Dev Summit, check out Laurence Moroney’s event recap here:

Recap of the 2020 TensorFlow Dev Summit
 

And Austin Kodra’s review of all that’s new in TensorFlow Lite:

TensorFlow Dev Summit 2020: TensorFlow Lite

 
Bio: Derrick Mwiti is a data analyst, a writer, and a mentor. He is driven by delivering great results in every task, and is a mentor at Lapid Leaders Africa.

Original. Reposted with permission.

Related: