AWS sagemaker documentation change
Summary
Updated SageMaker JumpStart fine-tuning documentation to use ModelTrainer instead of JumpStartEstimator. Changed SDK version reference from 2.x to 3.x, updated import statements, and modified code examples to use new ModelTrainer API.
Security assessment
Changes involve API updates and code example modifications without any mention of security vulnerabilities, patches, or security features. The updates focus on SDK version changes and class/method replacements.
Diff
diff --git a/sagemaker/latest/dg/jumpstart-curated-hubs-fine-tune.md b/sagemaker/latest/dg/jumpstart-curated-hubs-fine-tune.md index 2658b4c74..23bc5247b 100644 --- a//sagemaker/latest/dg/jumpstart-curated-hubs-fine-tune.md +++ b//sagemaker/latest/dg/jumpstart-curated-hubs-fine-tune.md @@ -87 +87 @@ The following procedure shows you how to fine-tune a model reference in your pri - 1. Make sure that you have the latest version (at least `2.242.0`) of the SageMaker Python SDK installed. For more information, see [ Use Version 2.x of the SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/v2.html). + 1. Make sure that you have the latest version (at least `2.242.0`) of the SageMaker Python SDK installed. For more information, see [ Use Version 3.x of the SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/). @@ -94,2 +94,3 @@ The following procedure shows you how to fine-tune a model reference in your pri - from sagemaker.jumpstart.estimator import JumpStartEstimator - from sagemaker.session import Session + from sagemaker.train import ModelTrainer + from sagemaker.core.jumpstart.configs import JumpStartConfig + from sagemaker.core.helper.session_helper import Session @@ -102 +103 @@ The following procedure shows you how to fine-tune a model reference in your pri - 4. Create a `JumpStartEstimator` and provide the JumpStart model ID, the name of your hub that contains the model reference, and your SageMaker Python SDK session. For a list of model IDs, see the [ Built-in Algorithms with Pre-trained Models Table](https://sagemaker.readthedocs.io/en/stable/doc_utils/pretrainedmodels.html). + 4. Create a `ModelTrainer` using `from_jumpstart_config` and provide the JumpStart model ID, the name of your hub that contains the model reference, and your SageMaker Python SDK session. For a list of model IDs, see the [ Built-in Algorithms with Pre-trained Models Table](https://sagemaker.readthedocs.io/en/stable/doc_utils/pretrainedmodels.html). @@ -104 +105 @@ The following procedure shows you how to fine-tune a model reference in your pri -Optionally, you can specify the `instance_type` and `instance_count` fields when creating the estimator. If you don't, the training job uses the default instance type and count for the model you're using. +Optionally, you can specify the `instance_type` and `instance_count` fields when creating the ModelTrainer. If you don't, the training job uses the default instance type and count for the model you're using. @@ -108 +109 @@ You can also optionally specify the `output_path` to the Amazon S3 location wher - estimator = JumpStartEstimator( + jumpstart_config = JumpStartConfig( @@ -111 +111,0 @@ You can also optionally specify the `output_path` to the Amazon S3 location wher - sagemaker_session=sm_session, # If you don't specify an existing session, a default one is created for you @@ -114,0 +115,2 @@ You can also optionally specify the `output_path` to the Amazon S3 location wher + ) + model_trainer = ModelTrainer.from_jumpstart_config(jumpstart_config=jumpstart_config) @@ -117 +118,0 @@ You can also optionally specify the `output_path` to the Amazon S3 location wher - ) @@ -119 +120,2 @@ You can also optionally specify the `output_path` to the Amazon S3 location wher - 5. Create a dictionary with the `training` key where you specify the location of your fine-tuning dataset. This example points to an Amazon S3 URI. If you have additional considerations, such as using local mode or multiple training data channels, see [ JumpStartEstimator.fit()](https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html#sagemaker.jumpstart.estimator.JumpStartEstimator.fit) in the SageMaker Python SDK documentation for more information. + + 5. Create a dictionary with the `training` key where you specify the location of your fine-tuning dataset. This example points to an Amazon S3 URI. If you have additional considerations, such as using local mode or multiple training data channels, see [ ModelTrainer.train()](https://sagemaker.readthedocs.io/en/stable/api/sagemaker_train.html) in the SageMaker Python SDK documentation for more information. @@ -125 +127 @@ You can also optionally specify the `output_path` to the Amazon S3 location wher - 6. Call the estimator's `fit()` method and pass in your training data and your EULA acceptance (if applicable). + 6. Call the model trainer's `train()` method and pass in your training data and your EULA acceptance (if applicable). @@ -131 +133 @@ The following example sets `accept_eula=False.` You should manually change the v - estimator.fit(inputs=training_input, accept_eula=False) + model_trainer.train(input_data_config=[training_input], accept_eula=False) @@ -140 +142 @@ You can check on your fine-tuning job by viewing your training jobs, either in t -You can access your fine-tuned model artifacts at the Amazon S3 `output_path` that was specified in the `JumpStartEstimator` object (either the default SageMaker AI Amazon S3 bucket for the region, or a custom Amazon S3 path you specified, if applicable). +You can access your fine-tuned model artifacts at the Amazon S3 `output_path` that was specified in the `ModelTrainer` object (either the default SageMaker AI Amazon S3 bucket for the region, or a custom Amazon S3 path you specified, if applicable).