Skip to content

comet_ml.start ΒΆ

start(
    api_key: Optional[str] = None,
    workspace: Optional[str] = None,
    project: Optional[str] = None,
    experiment_key: Optional[str] = None,
    mode: Optional[str] = None,
    online: Optional[bool] = None,
    experiment_config: Optional[ExperimentConfig] = None,
) -> ExperimentBase

Returns an Experiment object to log data to. It can be used to log data to a new Comet Experiment, append data to an Existing Experiment or continue logging to a running experiment locally.

Parameters:

  • api_key (str, default: None ) –

    Comet API key. It's recommended to configure the API Key with comet login.

  • workspace (str, default: None ) –

    Comet workspace name. If not provided, uses the default workspace.

  • project (str, default: None ) –

    Comet project name. Defaults to Uncategorized.

  • experiment_key (str, default: None ) –

    The Experiment identifier to be used for logging. This is used either to append data to an Existing Experiment or to control the key of new experiments (for example to match another identifier). Must be an alphanumeric string whose length is between 32 and 50 characters.

  • mode (str, default: None ) –

    Control how the Comet experiment is started.

    • "get_or_create": Starts a fresh experiment if required, or persists logging to an existing one.
    • "get": Continue logging to an existing experiment identified by the experiment_key value.
    • "create": Always creates of a new experiment, useful for HPO sweeps.
  • online (boolean, default: None ) –

    If True, the data will be logged to Comet server, otherwise it will be stored locally in an offline experiment. Default is True.

  • experiment_config (Optional[ExperimentConfig], default: None ) –

    additional configuration options.

Returns:

Raises:

  • ValueError –

    If no API Key is set in online mode.

  • ExperimentNotFound –

    If mode="get" and the experiment_key doesn't exists or you don't have access to it.

  • InvalidExperimentMode –
    • If mode="get" but no experiment_key was passed or configured.
    • If mode="create", an experiment_key was passed or configured and an Experiment with that Key already exists.

comet_ml.ExperimentConfig ΒΆ

ExperimentConfig(
    disabled: Optional[bool] = None,
    log_code: Optional[bool] = None,
    log_graph: Optional[bool] = None,
    parse_args: Optional[bool] = None,
    display_summary_level: int = 1,
    log_git_metadata: Optional[bool] = None,
    log_git_patch: Optional[bool] = None,
    log_env_details: Optional[bool] = None,
    log_env_gpu: Optional[bool] = None,
    log_env_host: Optional[bool] = None,
    log_env_cpu: Optional[bool] = None,
    log_env_network: Optional[bool] = None,
    log_env_disk: Optional[bool] = None,
    auto_output_logging: str = "default",
    auto_param_logging: bool = True,
    auto_metric_logging: bool = True,
    auto_log_co2: bool = True,
    auto_metric_step_rate: int = 10,
    auto_histogram_epoch_rate: int = 1,
    auto_histogram_gradient_logging: bool = False,
    auto_histogram_activation_logging: bool = False,
    auto_histogram_tensorboard_logging: bool = False,
    auto_histogram_weight_logging: bool = False,
    offline_directory: Optional[str] = None,
    distributed_node_identifier: Optional[str] = None,
    name: Optional[str] = None,
    tags: Optional[List[str]] = None,
)

The Comet experiment configuration. All of the following attributes can also be configured through environment variables or configuration files.

Attributes:

  • disabled (boolean) –

    Allows you to disable all network communication with the Comet.com backend. It is useful when you want to test to make sure everything is working, without actually logging anything. If not configured, defaults to False.

  • log_code (boolean) –

    Allows you to enable and disable automatic code logging. Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_graph (boolean) –

    Allows you to enable and disable automatic computation graph logging. Defaults to True when a new experiment is created and False when resuming an experiment.

  • parse_args (boolean) –

    Allows you to enable and disable automatic parsing of CLI arguments. Defaults to True when a new experiment is created and False when resuming an experiment.

  • display_summary_level (int) –

    Allows you to control the summary detail that is displayed on the console at the end of an experiment. If 0, the summary will not be displayed. Valid values are 0 to 2.

  • log_git_metadata (boolean) –

    Allows you to enable and disable automatic git metadata logging. Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_git_patch (boolean) –

    Allows you to enable and disable automatic git patch logging. Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_env_details (boolean) –

    Allows you to enable and disable automatic logging of various environment information in order to identify where the script ran. If log_env_details is False, GPU, CPU, network, disk and host information will not be logged. Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_env_gpu (boolean) –

    Allows you to enable and disable automatic logging of GPU details and metrics (utilization, memory usage, etc...). Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_env_host (boolean) –

    Allows you to enable and disable automatic logging of host information (ip, hostname, python version, user, etc...). Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_env_cpu (boolean) –

    Allows you to enable and disable automatic logging of CPU details and metrics (utilization, memory usage, etc...). Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_env_network (boolean) –

    Allows you to enable and disable automatic logging of network details and metrics (sent and received rates, etc...). Defaults to True when a new experiment is created and False when resuming an experiment.

  • log_env_disk (boolean) –

    Allows you to enable and disable automatic logging of disk utilization metrics (usage, IO rates, etc...). Defaults to True when a new experiment is created and False when resuming an experiment.

  • auto_output_logging ([default, native, simple, False]) –

    Allows you to select which output logging mode to use. You can pass "native" which will log all output even when it originated from a C native library. You can also pass "simple" which will work only for output made by Python code. If you want to disable automatic output logging, you can pass False. The default is "default" which will detect your environment and deactivate the output logging for IPython and Jupyter environment, sets "simple" for MacOS and sets "native" in the other cases.

  • auto_param_logging (boolean) –

    Allows you to enable and disable automatic hyperparameter logging.

  • auto_metric_logging (boolean) –

    Allows you to enable and disable automatic metric logging.

  • auto_log_co2 (boolean, optional, defaults to True) –

    Allows you to enable and disable automatic tracking of the CO2 emission of this experiment if codecarbon package is installed in the environment.

  • auto_metric_step_rate (int, optional, defaults to 10) –

    Allows you to control how often in-batch metrics are logged.

  • auto_histogram_epoch_rate (int, optional, defaults to 1) –

    Allows you to control how often histograms are logged.

  • auto_histogram_gradient_logging (boolean, optional, defaults to False) –

    Allows you to enable and disable automatic histogram logging of gradients.

  • auto_histogram_activation_logging (boolean, optional, defaults to False) –

    Allows you to enable and disable automatic histogram logging of activations.

  • auto_histogram_tensorboard_logging (boolean, optional, defaults to False) –

    Allows you to enable and disable automatic tensorboard histogram logging.

  • offline_directory (string) –

    Allows you to set the directory used to save the offline archive for the experiment. If not configured, defaults to None.

  • distributed_node_identifier (string) –

    Allows you to set a prefix as node identifier. If not configured, defaults to None.

  • name (string) –

    Allows you to set the name of the experiment. If not configured, a default random Experiment Name will be generated.

  • tags (List[str]) –

    Allows you to set tags to be associated with the experiment. If not configured, no tags will be added to the Experiment.

Sep. 17, 2024