Google Colab Runtime Selection
Is there way to change runtime type in Google Colab using python code instead of using GUI as shown in the image.
Google Colab Runtime Selection
Is there way to change runtime type in Google Colab using python code instead of using GUI as shown in the image.
You can read the notebook.ipynb into json string. Edit it, the overwrite it or create a new notebook file.
It may be easier to download it, edit it with a text editor, then upload and open it again.
For example, a notebook.ipynb with GPU runtime will look like this
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {...},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [...]
}
To change to Python 2.7, you change "name":"python2".
To change to GPU runtime, you add "accelerator": "GPU".
You can do this by hand (edit it in a text editor) or by Python (read json to dict, replace, overwrite, re-open).