Skip to content

integration.sagemaker

log_last_sagemaker_training_job_v1

comet_ml.integration.sagemaker.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.

Args:

  • api_key: string (optional), the Comet API Key. If not provided must be configured in another way
  • workspace: string (optional), attach the experiment to a project that belongs to this workspace. If not provided must be configured in another way
  • project_name: string (optional), send the experiment to a specific project. If not provided must be configured in another way
  • experiment: APIExperiment (optional), pass an existing APIExperiment to be used for logging.

Returns: an instance of APIExperiment for the created Experiment

log_sagemaker_training_job_v1

comet_ml.integration.sagemaker.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.

Here is an example of using this function:

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
)

Args:

  • estimator: sagemaker.estimator.Estimator (required), the estimator object that was used to start the training job.
  • api_key: string (optional), the Comet API Key. If not provided must be configured in another way.
  • workspace: string (optional), attach the experiment to a project that belongs to this workspace. If not provided must be configured in another way.
  • project_name: string (optional), send the experiment to a specific project. If not provided must be configured in another way.
  • experiment: APIExperiment (optional), pass an existing APIExperiment to be used for logging.

Returns: an instance of APIExperiment for the created Experiment

log_sagemaker_training_job_by_name_v1

comet_ml.integration.sagemaker.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.

Args:

  • sagemaker_job_name: string (required), the name of the Sagemaker Training Job.
  • api_key: string (optional), the Comet API Key. If not provided must be configured in another way
  • workspace: string (optional), attach the experiment to a project that belongs to this workspace. If not provided must be configured in another way
  • project_name: string (optional), send the experiment to a specific project. If not provided must be configured in another way
  • experiment: APIExperiment (optional), pass an existing APIExperiment to be used for logging.

Returns: an instance of APIExperiment for the created Experiment

Mar. 27, 2024