Skip to content

comet_ml.integration.sagemaker ¶

log_last_sagemaker_training_job_v1 ¶

log_last_sagemaker_training_job_v1(
    api_key: Optional[str] = None,
    workspace: Optional[str] = None,
    project_name: Optional[str] = None,
    experiment: Optional[APIExperiment] = None,
)

This function retrieves the last training job and logs its data as a Comet Experiment. The training job must be in completed status.

This API is in BETA.

Parameters:

  • api_key (Optional[str], default: None ) –

    The Comet API Key. If not provided must be configured in another way

  • workspace (Optional[str], default: None ) –

    Attach the experiment to a project that belongs to this workspace. If not provided must be configured in another way

  • project_name (Optional[str], default: None ) –

    Send the experiment to a specific project. If not provided must be configured in another way

  • experiment (Optional[APIExperiment], default: None ) –

    Pass an existing APIExperiment to be used for logging.

log_sagemaker_training_job_by_name_v1 ¶

log_sagemaker_training_job_by_name_v1(
    sagemaker_job_name: str,
    api_key: Optional[str] = None,
    workspace: Optional[str] = None,
    project_name: Optional[str] = None,
    experiment: Optional[APIExperiment] = None,
)

This function logs the training job identified by the sagemaker_job_name as a Comet Experiment. The training job must be in completed status.

This API is in BETA.

Parameters:

  • sagemaker_job_name (str) –

    The name of the Sagemaker Training Job.

  • api_key (Optional[str], default: None ) –

    The Comet API Key. If not provided must be configured in another way.

  • workspace (Optional[str], default: None ) –

    Attach the experiment to a project that belongs to this workspace. If not provided must be configured in another way.

  • project_name (Optional[str], default: None ) –

    Send the experiment to a specific project. If not provided must be configured in another way.

  • experiment (Optional[APIExperiment], default: None ) –

    Pass an existing APIExperiment to be used for logging.

log_sagemaker_training_job_v1 ¶

log_sagemaker_training_job_v1(
    estimator: sagemaker.estimator.Estimator,
    api_key: Optional[str] = None,
    workspace: Optional[str] = None,
    project_name: Optional[str] = None,
    experiment: Optional[APIExperiment] = None,
)

This function retrieves the last training job from an sagemaker.estimator.Estimator object and log its data as a Comet Experiment. The training job must be in completed status.

This API is in BETA.

Parameters:

  • estimator (Estimator) –

    The estimator object that was used to start the training job.

  • api_key (Optional[str], default: None ) –

    The Comet API Key. If not provided must be configured in another way.

  • workspace (Optional[str], default: None ) –

    Attach the experiment to a project that belongs to this workspace. If not provided must be configured in another way.

  • project_name (Optional[str], default: None ) –

    Send the experiment to a specific project. If not provided must be configured in another way.

  • experiment (Optional[APIExperiment], default: None ) –

    Pass an existing APIExperiment to be used for logging.

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import sagemaker

from comet_ml.integration.sagemaker import log_sagemaker_training_job_v1

estimator = sagemaker.estimator.Estimator(
    training_image,
    role,
    instance_count=instance_count,
    instance_type=instance_type,
    output_path=s3_output_location,
)

estimator.fit(s3_input_location)

api_experiment = log_sagemaker_training_job_v1(
    estimator, api_key=API_KEY, workspace=WORKSPACE, project_name=PROJECT_NAME
)
Nov. 18, 2024