Skip to content

Commit 61e44ad

Browse files
authored
Cleanup hpo branch (aws#13)
aws#11 updated master to reflect the public SDK. This change brings this branch up to date.
1 parent 0a655e8 commit 61e44ad

File tree

125 files changed

+2155
-1441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2155
-1441
lines changed

.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
application_import_names = sagemaker, tests
3+
import-order-style = google

.github/issue_template.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Please fill out the form below.
2+
3+
### System Information
4+
- **Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans)**:
5+
- **Framework Version**:
6+
- **Python Version**:
7+
- **CPU or GPU**:
8+
- **Python SDK Version**:
9+
- **Are you using a custom image**:
10+
11+
### Describe the problem
12+
Describe the problem or feature request clearly here.
13+
14+
### Minimal repro / logs
15+
Please provide any logs and a bare minimum reproducible test case, as this will be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
16+
17+
- **Exact command to reproduce**:

CHANGELOG.rst

+17-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22
CHANGELOG
33
=========
44

5+
6+
1.2.dev5
7+
========
8+
9+
* bug-fix: Change module names to string type in __all__
10+
* feature: Save training output files in local mode
11+
* bug-fix: tensorflow-serving-api: SageMaker does not conflict with tensorflow-serving-api module version
12+
* feature: Local Mode: add support for local training data using file://
13+
* feature: Updated TensorFlow Serving api protobuf files
14+
15+
1.2.4
16+
=====
17+
18+
* feature: Estimators: add support for Amazon Random Cut Forest algorithm
19+
520
1.2.3
6-
=========
21+
=====
22+
723
* bug-fix: Fix local mode not using the right s3 bucket
824

925
1.2.2

README.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ You can install from source by cloning this repository and issuing a pip install
4747

4848
git clone https://github.com/aws/sagemaker-python-sdk.git
4949
python setup.py sdist
50-
pip install dist/sagemaker-1.2.3.tar.gz
50+
pip install dist/sagemaker-1.2.4.tar.gz
5151

5252
Supported Python versions
5353
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -148,7 +148,7 @@ Local Mode
148148
~~~~~~~~~~
149149

150150
The SageMaker Python SDK now supports local mode, which allows you to create TensorFlow, MXNet and BYO estimators and
151-
deploy to your local environment.  This is a great way to test your deep learning script before running in
151+
deploy to your local environment. This is a great way to test your deep learning script before running in
152152
SageMaker's managed training or hosting environments.
153153

154154
We can take the example in `Estimator Usage <#estimator-usage>`__ , and use either ``local`` or ``local_gpu`` as the
@@ -166,6 +166,9 @@ instance type.
166166
# In Local Mode, fit will pull the MXNet container docker image and run it locally
167167
mxnet_estimator.fit('s3://my_bucket/my_training_data/')
168168
169+
# Alternatively, you can train using data in your local file system. This is only supported in Local mode.
170+
mxnet_estimator.fit('file:///tmp/my_training_data')
171+
169172
# Deploys the model that was generated by fit() to local endpoint in a container
170173
mxnet_predictor = mxnet_estimator.deploy(initial_instance_count=1, instance_type='local')
171174
@@ -184,7 +187,7 @@ For detailed examples of running docker in local mode, see:
184187
A few important notes:
185188

186189
- Only one local mode endpoint can be running at a time
187-
- Since the data are pulled from S3 to your local environment, please ensure you have sufficient space.
190+
- If you are using s3 data as input, it will be pulled from S3 to your local environment, please ensure you have sufficient space.
188191
- If you run into problems, this is often due to different docker containers conflicting.  Killing these containers and re-running often solves your problems.
189192
- Local Mode requires docker-compose and `nvidia-docker2 <https://github.com/NVIDIA/nvidia-docker>`__ for ``local_gpu``.
190193
- Distributed training is not yet supported for ``local_gpu``.
@@ -1575,7 +1578,7 @@ Amazon SageMaker provides several built-in machine learning algorithms that you
15751578
15761579
The full list of algorithms is available on the AWS website: https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html
15771580
1578-
SageMaker Python SDK includes Estimator wrappers for the AWS K-means, Principal Components Analysis(PCA), Linear Learner, Factorization Machines, Latent Dirichlet Allocation(LDA) and Neural Topic Model(NTM) algorithms.
1581+
SageMaker Python SDK includes Estimator wrappers for the AWS K-means, Principal Components Analysis(PCA), Linear Learner, Factorization Machines, Latent Dirichlet Allocation(LDA), Neural Topic Model(NTM) and Random Cut Forest algorithms.
15791582
15801583
Definition and usage
15811584
~~~~~~~~~~~~~~~~~~~~

doc/conf.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
# -*- coding: utf-8 -*-
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
215
import os
316
import sys
417
from datetime import datetime
@@ -19,7 +32,7 @@ def __getattr__(cls, name):
1932
'numpy', 'scipy', 'scipy.sparse']
2033
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
2134

22-
version = '1.2.3'
35+
version = '1.2.4'
2336
project = u'sagemaker'
2437

2538
# Add any Sphinx extension module names here, as strings. They can be extensions

doc/randomcutforest.rst

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Random Cut Forest
2+
--------------------
3+
4+
The Amazon SageMaker Random Cut Forest algorithm.
5+
6+
.. autoclass:: sagemaker.RandomCutForest
7+
:members:
8+
:undoc-members:
9+
:show-inheritance:
10+
:inherited-members:
11+
:exclude-members: image, num_trees, num_samples_per_tree, eval_metrics, MINI_BATCH_SIZE
12+
13+
14+
.. autoclass:: sagemaker.RandomCutForestModel
15+
:members:
16+
:undoc-members:
17+
:show-inheritance:
18+
19+
.. autoclass:: sagemaker.RandomCutForestPredictor
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:

setup.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
import os
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
215
from glob import glob
3-
from os.path import basename
4-
from os.path import splitext
16+
import os
517

618
from setuptools import setup, find_packages
719

@@ -11,11 +23,11 @@ def read(fname):
1123

1224

1325
setup(name="sagemaker",
14-
version="1.3.dev",
26+
version="1.2.4",
1527
description="Open source library for training and deploying models on Amazon SageMaker.",
1628
packages=find_packages('src'),
1729
package_dir={'': 'src'},
18-
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
30+
py_modules=[os.splitext(os.basename(path))[0] for path in glob('src/*.py')],
1931
long_description=read('README.rst'),
2032
author="Amazon Web Services",
2133
url='https://github.com/aws/sagemaker-python-sdk/',

src/sagemaker/__init__.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -20,6 +20,7 @@
2020
from sagemaker.amazon.factorization_machines import FactorizationMachines, FactorizationMachinesModel
2121
from sagemaker.amazon.factorization_machines import FactorizationMachinesPredictor
2222
from sagemaker.amazon.ntm import NTM, NTMModel, NTMPredictor
23+
from sagemaker.amazon.randomcutforest import RandomCutForest, RandomCutForestModel, RandomCutForestPredictor
2324

2425
from sagemaker.local.local_session import LocalSession
2526

@@ -32,9 +33,10 @@
3233
from sagemaker.session import get_execution_role
3334

3435

35-
__all__ = [estimator, KMeans, KMeansModel, KMeansPredictor, PCA, PCAModel, PCAPredictor, LinearLearner,
36-
LinearLearnerModel, LinearLearnerPredictor,
37-
LDA, LDAModel, LDAPredictor,
38-
FactorizationMachines, FactorizationMachinesModel, FactorizationMachinesPredictor,
39-
Model, NTM, NTMModel, NTMPredictor, RealTimePredictor, Session, LocalSession,
40-
container_def, s3_input, production_variant, get_execution_role]
36+
__all__ = ['estimator', 'KMeans', 'KMeansModel', 'KMeansPredictor', 'PCA', 'PCAModel', 'PCAPredictor', 'LinearLearner',
37+
'LinearLearnerModel', 'LinearLearnerPredictor',
38+
'LDA', 'LDAModel', 'LDAPredictor',
39+
'FactorizationMachines', 'FactorizationMachinesModel', 'FactorizationMachinesPredictor',
40+
'RandomCutForest', 'RandomCutForestModel', 'RandomCutForestPredictor',
41+
'Model', 'NTM', 'NTMModel', 'NTMPredictor', 'RealTimePredictor', 'Session', 'LocalSession',
42+
'container_def', 's3_input', 'production_variant', 'get_execution_role']

src/sagemaker/amazon/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of

src/sagemaker/amazon/amazon_estimator.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
import json
1416
import logging
1517
import tempfile
@@ -231,7 +233,8 @@ def upload_numpy_to_s3_shards(num_shards, s3, bucket, key_prefix, array, labels=
231233

232234
def registry(region_name, algorithm=None):
233235
"""Return docker registry for the given AWS region"""
234-
if algorithm in [None, "pca", "kmeans", "linear-learner", "factorization-machines", "ntm"]:
236+
if algorithm in [None, "pca", "kmeans", "linear-learner", "factorization-machines", "ntm",
237+
"randomcutforest"]:
235238
account_id = {
236239
"us-east-1": "382416733822",
237240
"us-east-2": "404615174143",

src/sagemaker/amazon/common.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
import io
1416
import struct
1517
import sys

src/sagemaker/amazon/factorization_machines.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry
1416
from sagemaker.amazon.common import numpy_to_record_serializer, record_deserializer
1517
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa

src/sagemaker/amazon/hyperparameter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.hpo import _HpoParameter
1416

1517

src/sagemaker/amazon/kmeans.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry
1416
from sagemaker.amazon.common import numpy_to_record_serializer, record_deserializer
1517
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa

src/sagemaker/amazon/lda.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry
1416
from sagemaker.amazon.common import numpy_to_record_serializer, record_deserializer
1517
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa

src/sagemaker/amazon/linear_learner.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry
1416
from sagemaker.amazon.common import numpy_to_record_serializer, record_deserializer
1517
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa

src/sagemaker/amazon/ntm.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry
1416
from sagemaker.amazon.common import numpy_to_record_serializer, record_deserializer
1517
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa

src/sagemaker/amazon/pca.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -10,6 +10,8 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
from __future__ import absolute_import
14+
1315
from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase, registry
1416
from sagemaker.amazon.common import numpy_to_record_serializer, record_deserializer
1517
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa

0 commit comments

Comments
 (0)