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 API reference please go to: Read the Docs
- Installing SageMaker Python SDK
- Using the SageMaker Python SDK
- MXNet SageMaker Estimators
- TensorFlow SageMaker Estimators
- Chainer SageMaker Estimators
- PyTorch SageMaker Estimators
- Scikit-learn SageMaker Estimators
- SageMaker Reinforcement Learning Estimators
- SageMaker SparkML Serving
- AWS SageMaker Estimators
- Using SageMaker AlgorithmEstimators
- Consuming SageMaker Model Packages
- BYO Docker Containers with SageMaker Estimators
- SageMaker Automatic Model Tuning
- SageMaker Batch Transform
- Secure Training and Inference with VPC
- BYO Model
- Inference Pipelines
- SageMaker Workflow
The SageMaker Python SDK is built to PyPI and can be installed with pip as follows:
pip install sagemaker
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.git cd sagemaker-python-sdk pip install .
SageMaker Python SDK supports Unix/Linux and Mac.
SageMaker Python SDK is tested on:
- Python 2.7
- Python 3.6
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.
However, if you are using an IAM role with a path in it, you should grant permission for iam:GetRole.
SageMaker Python SDK is licensed under the Apache 2.0 License. It is copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. The license is available at: http://aws.amazon.com/apache2.0/
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 Python 2.7 and 3.6, so to run unit tests with the same configuration we do, you'll need to have interpreters for Python 2.7 and Python 3.6 installed.
To run the unit tests with tox, run:
tox tests/unit
Integrations tests
To run the integration tests, the following prerequisites must be met
- AWS account credentials are available in the environment for the boto3 client to use.
- The AWS account has an IAM role named
SageMakerRolewith the AmazonSageMakerFullAccess policy attached.
We recommend selectively running just those integration tests you'd like to run. You can filter by individual test function names with:
pytest -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:
pytest tests/integ
You can also run them in parallel:
pytest -n auto tests/integ
cd into the doc directory and run:
make html
You can edit the templates for any of the pages in the docs by editing the .rst files in the "doc" directory and then running "make html" again.
By using MXNet SageMaker Estimators, you can train and host MXNet models on Amazon SageMaker.
Supported versions of MXNet: 1.3.0, 1.2.1, 1.1.0, 1.0.0, 0.12.1.
Supported versions of MXNet for Elastic Inference: 1.3.0
We recommend that you use the latest supported version, because that's where we focus most of our development efforts.
For more information, see Using MXNet with the SageMaker Python SDK.
< 9D8A div class="markdown-heading" dir="auto">