AWS sagemaker documentation change
Summary
Removed legacy SageMaker Python SDK v2/v3 code examples from training job tutorial
Security assessment
Removal of outdated code samples doesn't indicate security issues. No security features added or vulnerabilities addressed in the change.
Diff
diff --git a/sagemaker/latest/dg/sagemaker-hyperpod-gpu-sagemaker-training-jobs-pretrain-tutorial.md b/sagemaker/latest/dg/sagemaker-hyperpod-gpu-sagemaker-training-jobs-pretrain-tutorial.md index df3052d64..2ccab3833 100644 --- a//sagemaker/latest/dg/sagemaker-hyperpod-gpu-sagemaker-training-jobs-pretrain-tutorial.md +++ b//sagemaker/latest/dg/sagemaker-hyperpod-gpu-sagemaker-training-jobs-pretrain-tutorial.md @@ -97,3 +96,0 @@ You can use the following Python code to run a SageMaker training job with your -SageMaker Python SDK v3 - - @@ -153,53 +149,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - - import os - import sagemaker,boto3 - from sagemaker.debugger import TensorBoardOutputConfig - - from sagemaker.pytorch import PyTorch - - sagemaker_session = sagemaker.Session() - role = sagemaker.get_execution_role() - - bucket = sagemaker_session.default_bucket() - output = os.path.join(f"s3://{bucket}", "output") - output_path = "<s3-URI>" - - overrides = { - "run": { - "results_dir": "/opt/ml/model", - }, - "exp_manager": { - "exp_dir": "", - "explicit_log_dir": "/opt/ml/output/tensorboard", - "checkpoint_dir": "/opt/ml/checkpoints", - }, - "model": { - "data": { - "train_dir": "/opt/ml/input/data/train", - "val_dir": "/opt/ml/input/data/val", - }, - }, - } - - tensorboard_output_config = TensorBoardOutputConfig( - s3_output_path=os.path.join(output, 'tensorboard'), - container_local_output_path=overrides["exp_manager"]["explicit_log_dir"] - ) - - estimator = PyTorch( - output_path=output_path, - base_job_name=f"llama-recipe", - role=role, - instance_type="ml.p5.48xlarge", - training_recipe="training/llama/hf_llama3_8b_seq8k_gpu_p5x16_pretrain", - recipe_overrides=recipe_overrides, - sagemaker_session=sagemaker_session, - tensorboard_output_config=tensorboard_output_config, - ) - - estimator.fit(inputs={"train": "s3 or fsx input", "val": "s3 or fsx input"}, wait=True) - - @@ -216,3 +159,0 @@ When you deploy the endpoint for a SageMaker training job, you must specify the -SageMaker Python SDK v3 - - @@ -235,9 +175,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - - from sagemaker import image_uris - container=image_uris.retrieve(framework='pytorch',region='us-west-2',version='2.0',py_version='py310',image_scope='inference', instance_type='ml.p4d.24xlarge') - predictor = estimator.deploy(initial_instance_count=1,instance_type='ml.p4d.24xlarge',image_uri=container) - -