Skip to content

Track experiments with Comet

# For Comet to start tracking a training run,
# just add these two lines at the top of
# your training script:
import comet_ml

experiment = comet_ml.Experiment(
    api_key="<Your API Key>",
    project_name="<Your Project Name>"
)

# Metrics from this training run will now be
# available in the Comet UI

By simply adding these two lines of code in your training code to Comet's Experiment object, you automatically begin to log new data to Comet. You can then easily visualize the data in the Comet UI.

To learn more, see Experiment.

Note

There are alternatives to setting the API key programatically. See more here.

Automatic logging with supported frameworks

Comet logs additional information about your run, depending on the framework you are using. Comet supports the more popular frameworks, among them PyTorch, Hugging Face, and scikit-learn. For more details on automatic logging, check out Framework-dependent automatic logging.

Try it out!

To track your first Experiment, try our Quick Start.

Learn more

To learn more, check out our end-to-end examples for more detailed examples.

Nov. 29, 2022