​Google Colab is a temporary runtime environment. This means you lose all your data (unless saved externally) once you restart your kernel.
This is where you can leverage Neptune. By making your runs on Google Colab and tracking them with Neptune you can log and download things like:
parameters,
metrics and losses,
hardware consumption,
model checkpoints and other artifacts.
By doing that you can keep your run data safe even when the Google Colab kernel has died.
See the full list of things that you can log and how to download this data from Neptune.
This guide will show you how to:
Install neptune-client
,
Connect Neptune to your notebook and create the first run,
Log simple metrics to Neptune and explore them in the Neptune UI.
Make sure that you have an account with both Google and Neptune.
Go to your first cell in Google Colab and install neptune-client
:
! pip install neptune-client
Go to the Neptune web app and get your API token.
Run the code below:
from getpass import getpassapi_token = getpass('Enter your private Neptune API token: ')
Enter the token in the input box. This will save your token to api_token
.
Learn more how to find API token.
Run the code below:
import neptune.new as neptune​run = neptune.init(project='my_workspace/my_project')
Run the code below:
# Track metadata and hyperparameters of your runrun["JIRA"] = "NPT-952"run["algorithm"] = "ConvNet"​params = {"batch_size": 64,"dropout": 0.2,"learning_rate": 0.001,"optimizer": "Adam"}run["parameters"] = params​​# Track the training process by logging your training metricsfor epoch in range(100):run["train/accuracy"].log(epoch * 0.6)run["train/loss"].log(epoch * 0.4)​# Log the final scorerun["f1_score"] = 0.66
Follow the link shown to view your run progress and metrics in the Neptune UI.
Now that you know how to integrate Neptune with Google Colab, you can check:
Other Neptune integrations​