Skip to main content
SageMaker

SageMaker Python SDK

Latest Version Conda-Forge Version Supported Python Versions Code style: black Documentation Status CI Health

SageMaker Python SDK is an open source library for training and deploying machine learning models on Amazon SageMaker.

With the SDK, you can train and deploy models using popular deep learning frameworks Apache MXNet and TensorFlow. You can also train and deploy models with Amazon algorithms, which are scalable implementations of core machine learning algorithms that are optimized for SageMaker and GPU training. If you have your own algorithms built into SageMaker compatible Docker containers, you can train and host models using these as well.

For detailed documentation, including the API reference, see Read the Docs.

Table of Contents

  1. Installing SageMaker Python SDK

  2. Using the SageMaker Python SDK

Installing the SageMaker Python SDK Train

You can install from source by cloning this repository and running a pip install command in the root directory of the repository:

git clone https://github.com/aws/sagemaker-python-sdk-staging.git
cd sagemaker-python-sdk-staging/sagemaker_train
pip install .

Supported Operating Systems

SageMaker Python SDK supports Unix/Linux and Mac.

Supported Python Versions

SageMaker Python SDK is tested on:

  • Python 3.10

  • Python 3.11

  • Python 3.12

Telemetry

The sagemaker library has telemetry enabled to help us better understand user needs, diagnose issues, and deliver new features. This telemetry tracks the usage of various SageMaker functions.

If you prefer to opt out of telemetry, you can easily do so by setting the TelemetryOptOut parameter to true in the SDK defaults configuration. For detailed instructions, please visit Configuring and using defaults with the SageMaker Python SDK.

AWS Permissions

As a managed service, Amazon SageMaker performs operations on your behalf on the AWS hardware that is managed by Amazon SageMaker. Amazon SageMaker can perform only operations that the user permits. You can read more about which permissions are necessary in the AWS Documentation.

The SageMaker Python SDK should not require any additional permissions aside from what is required for using SageMaker. However, if you are using an IAM role with a path in it, you should grant permission for iam:GetRole.

Licensing

SageMaker Python SDK is licensed under the Apache 2.0 License. It is copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. The license is available at: http://aws.amazon.com/apache2.0/

Running tests

SageMaker Python SDK has unit tests and integration tests.

You can install the libraries needed to run the tests by running pip install --upgrade .[test] or, for Zsh users: pip install --upgrade .\[test\]

Unit tests

We run unit tests with tox, which is a program that lets you run unit tests for multiple Python versions, and also make sure the code fits our style guidelines. We run tox with all of our supported Python versions, so to run unit tests with the same configuration we do, you need to have interpreters for those Python versions installed.

To run the unit tests with tox, run:

tox tests/unit

Integration tests

To run the integration tests, the following prerequisites must be met

  1. AWS account credentials are available in the environment for the boto3 client to use.

  2. The AWS account has an IAM role named SageMakerRole. It should have the AmazonSageMakerFullAccess policy attached as well as a policy with the necessary permissions to use Elastic Inference.

  3. To run remote_function tests, dummy ecr repo should be created. It can be created by running -

    aws ecr create-repository --repository-name remote-function-dummy-container

We recommend selectively running just those integration tests you’d like to run. You can filter by individual test function names with:

tox -- -k 'test_i_care_about'

You can also run all of the integration tests by running the following command, which runs them in sequence, which may take a while:

tox -- tests/integ

You can also run them in parallel:

tox -- -n auto tests/integ

Git Hooks

to enable all git hooks in the .githooks directory, run these commands in the repository directory:

find .git/hooks -type l -exec rm {} \;
find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \;

To enable an individual git hook, simply move it from the .githooks/ directory to the .git/hooks/ directory.

Release files for sagemaker-train 1.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sagemaker-train 1.21.0
File Size Uploaded
sagemaker_train-1.21.0.tar.gz 369.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sagemaker-train 1.21.0
File Interpreter ABI Platform
sagemaker_train-1.21.0-py3-none-any.whl Python 3 none any Details

Total release size: 816.8 kB

Release files / sagemaker_train-1.21.0.tar.gz

Download URL sagemaker_train-1.21.0.tar.gz
Size 369.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eb43286a2c1386f55d1edc74c29db0fe3800ac6c90523d944a96d93cd6c3bea3
BLAKE2b-256 checksum
How to use checksums
94f84c79e86be92c20ae8b36e131d0a88437cf6eae3027a7a572c1ea7db1cbbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / sagemaker_train-1.21.0-py3-none-any.whl

Download URL sagemaker_train-1.21.0-py3-none-any.whl
Size 447.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5e7551f3f6cb1197d6bc80a4c2ccbc7b7da54109b039f4ed87eb6ebb077f467
BLAKE2b-256 checksum
How to use checksums
6d77ee9cecaa2e98a5d5f7e68b8bb21e4b3f1dce25c5171d73c59549a7371ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

1.23.0

2 release files

1.22.1

2 release files

1.22.0

2 release files

This release

1.21.0 This release

2 release files

1.20.0

2 release files

1.19.0

2 release files

1.18.0

2 release files

1.17.0

2 release files

1.16.0

2 release files

1.15.1

2 release files

1.15.0

2 release files

1.14.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page