Skip to content

Python Getting Started

Getting started in Python: 30 seconds to

The core class of is an Experiment, a specific run of a script that generated a result such as training a model on a single set of hyperparameters. An Experiment. will automatically log scripts output (stdout/stderr), code, and command line arguments on any script and for the supported libraries will also log hyperparameters, metrics and model configuration.

To make it easy, you can just put your personal Comet API key directly as a parameter to Experiment:

from comet_ml import Experiment
experiment = Experiment(YOUR-PERSONAL-API-KEY)

# Your code.

Or, even better, put your API key in a Comet config file and leave it out of your source code:

from comet_ml import Experiment
experiment = Experiment()

# Your code.

Automatic Logging

Comet can track many items automatically by merely creating an Experiment() object in your code. Here is a list of what is automatically tracked by framework:

Framework What is automatically logged
fastai all pytorch items, plus epochs, and metrics
keras model description, steps, metrics, hyperparameters, optimizer config, and number of trainable parameters
pytorch model description, steps, and loss
sklearn hyperparameters
tensorflow metrics

For more details see Python SDK/Advanced.