Comparing AWS SageMaker Studio Lab with Google Colab
The battle of managed services for notebooks
What are notebooks?
The use of Jupyter notebooks has become very common in exploratory work in Data Science and Machine Learning (ML). The notebooks provide a great help in running program modules iteratively, which becomes super useful in data science. As an example, you can test different hyper-parameters of your ML model without running the data preprocessing steps. Notebooks also allow you to mesh code with annonated comments, which make them super useful as a medium for instructions and sharing. At ‘Learn With a Robot’ we have used Jupyter notebooks extensively as an instructional medium.
Notebooks as Managed Services
Jupyter notebooks are now available as managed services, the prime example being Google Colab. Managed services help in many ways, mainly for working with different team members. With managed resources, you can also get access to superior resources such as the GPU, which you might not be able to afford in your home lab. Google Colab has taken the concept of a managed Jupyter notebook to the next level, offering a free service as well as premier paid plans for users in the form of Google Colab Pro ($9.99/month) and Google Colab Pro+ ($49.99/month) when this article was written.
Enter Sagemaker Studio Lab
At re:Invent 2021, AWS introduced the Sagemaker Studio Lab (Henceforth referred to as Studio Lab) to compete with Google Colab (Henceforth referred to as Colab). Studio Lab is available invite-only, but you will get access with a day of signing up. Studio Lab is completely free at the point of time when this article was written. In this article, we compare the Studio Lab versus the Colab. Another perspective on the comparison is available at Roboflow.
Persistent environment versus interactive environment
Studio offers a persistent environment. You can choose to run a CPU based environment for 12 hours or a GPU based environment for 4 hours. This environment will keep running for that long unless you stop it via the console. If you start any job, such as a ML training session, the job will continue even if you close your browser. The results will be ready (as long as the training completes within the dedicated run time of your instance (4/12 hours). On the other hand, Colab presents an interactive environment. Colab will terminate the notebook connection if it detects that the notebook is idling. An open browser is required for Colab to keep its connection, which implies that if you run a heavy ML training job in Colab, you would need to keep a browser session open (or better watch over it). Colab does offer paid subscription features with Colab Pro and Colab Pro+ which allow one to keep running a notebook without interactivity. Here is what the Colab terms have to say on this topic:
“Users without a paid subscription should not rely on execution to continue in the background; execution will be interrupted when user interaction ceases, and the VM will be deleted soon after that.”
Studio Lab offers you 15 GB of persistent storage. For me, this is truly the dealbreaker and biggest differentiator. With Colab, you needed to always save your work in Google Drive and pick it up from Drive in your next session. If you are requiring some unsupported packages, you would need to install these packages in every session. Studio Lab automatically stores your work in the persistent storage that is added to the lab environment. You can access that data at any point of time by simply starting a CPU instance.
This is unlikely to be a deal breaker for most people, but the Studio Lab terminal was very useful for me since it gives me a unix like interface which I can use to explore the directory structure, use tools to understand how the system is working, or simply print file contents. In other words, you get an environment beyond a simple managed notebook, you get the equivalent of a hosted computer where you could run any of your regular programs if you needed to.
As an example, I wanted to understand how efficiently the GPU resources were utilized. I opened up a terminal and ran the tool: nvidia-smi. Here is an output of this tool.
We can see that the GPU is indeed the Tesla T4. We are utilizing about 84% of the GPU resource.
Google Colab gives you access to Tesla K80 GPUs in the free tier (In some cases you might be lucky to get a Tesla T4, Tesla T100, or TeslaP100, but I have found that regular users usually are limited to getting the Tesla K80). Colab Pro and Colab Pro+ give you access to fancier GPUs. Studio Lab goes you access to a much fancier GPU, the Tesla T4. The price difference between these two GPUs at the time of this article is ~10x. The following figure presents a snapshot of comparison between the 2 GPUs.
Google Colab is definitely way easier if you wanted to share your notebook, you can simply create a link, give permissions, and share. As an example, when you click the “Share” link in your Colab notebook, you see the following:
You can simply add email addresses and share the notebook. You could also share links to individual cells of the notebook. With Studio Lab, you would have to sync with a git repository and share that git repository. Sharing via git is definitely a better code practice, do if you want a professional way of doing things, definitely use Git. But for those looking for a more simpler and amateur way, Google Colab definitely helps.
To summarize, I am fully sold into the Studio Lab as it exists at the time this article is written. But the cloud world is very dynamic, what is a paid service today becomes free tomorrow. Google and AWS are also always trying to out compete each other. So, at ‘Learn With a Robot’ we will make sure to post an update as and when things change. Please subscribe, so that you can get the latest updates on this topic in your inbox. If you liked this article, you can also consider buying me a coffee.
In addition, if you tried both Studio Lab and Colab and would like to add to this article, please add in the comments or reach out to me.