Skip to content

fix: correct sagemaker methods over deprecated ones after Sagemaker SDK V2 update #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
"source": [
"import sagemaker\n",
"from sagemaker import get_execution_role\n",
"from sagemaker.amazon.amazon_estimator import get_image_uri\n",
"from sagemaker import image_uris\n",
"# from sagemaker.amazon.amazon_estimator import get_image_uri - deprecated on Sagemaker SDK v2\n",
"from sagemaker.predictor import csv_serializer\n",
"\n",
"# This is an object that represents the SageMaker session that we are currently operating in. This\n",
Expand Down Expand Up @@ -216,13 +217,13 @@
"outputs": [],
"source": [
"# As stated above, we use this utility method to construct the image name for the training container.\n",
"container = get_image_uri(session.boto_region_name, 'xgboost')\n",
"container = image_uris.retrieve('xgboost', session.boto_region_name, version='latest')\n",
"\n",
"# Now that we know which container to use, we can construct the estimator object.\n",
"xgb = sagemaker.estimator.Estimator(container, # The image name of the training container\n",
" role, # The IAM role to use (our current role in this case)\n",
" train_instance_count=1, # The number of instances to use for training\n",
" train_instance_type='ml.m4.xlarge', # The type of instance to use for training\n",
" instance_count=1, # The number of instances to use for training\n",
" instance_type='ml.m4.xlarge', # The type of instance to use for training\n",
" output_path='s3://{}/{}/output'.format(session.default_bucket(), prefix),\n",
" # Where to save the output (the model artifacts)\n",
" sagemaker_session=session) # The current SageMaker session"
Expand Down Expand Up @@ -393,9 +394,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "conda_pytorch_p36",
"display_name": "Python 3",
"language": "python",
"name": "conda_pytorch_p36"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -407,7 +408,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.8.5"
}
},
"nbformat": 4,
Expand Down