Skip to content

Commit 5875efd

Browse files
authored
Merge branch 'master' into patch-2
2 parents 60767e5 + afa0b42 commit 5875efd

Some content is hidden

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

45 files changed

+929
-110
lines changed

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# Changelog
22

3+
## v2.14.0 (2020-10-05)
4+
5+
### Features
6+
7+
* upgrade Neo MxNet to 1.7
8+
9+
### Bug Fixes and Other Changes
10+
11+
* add a condition to retrieve correct image URI for xgboost
12+
13+
## v2.13.0 (2020-09-30)
14+
15+
### Features
16+
17+
* add xgboost framework version 1.2-1
18+
19+
### Bug Fixes and Other Changes
20+
21+
* revert "feature: upgrade Neo MxNet to 1.7 (#1928)"
22+
23+
## v2.12.0 (2020-09-29)
24+
25+
### Features
26+
27+
* upgrade Neo MxNet to 1.7
28+
29+
## v2.11.0 (2020-09-28)
30+
31+
### Features
32+
33+
* Add SDK support for SparkML Serving Container version 2.4
34+
35+
### Bug Fixes and Other Changes
36+
37+
* pin pytest version <6.1.0 to avoid pytest-rerunfailures breaking changes
38+
* temporarily skip the MxNet Neo test until we fix them
39+
40+
### Documentation Changes
41+
42+
* fix conda setup for docs
43+
44+
## v2.10.0 (2020-09-23)
45+
46+
### Features
47+
48+
* add inferentia pytorch inference container config
49+
350
## v2.9.2 (2020-09-21)
451

552
### Bug Fixes and Other Changes

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Setup a Python environment, and install the dependencies listed in ``doc/require
164164
# conda
165165
conda create -n sagemaker python=3.7
166166
conda activate sagemaker
167-
conda install --file doc/requirements.txt
167+
conda install sphinx=3.1.1 sphinx_rtd_theme=0.5.0
168168

169169
# pip
170170
pip install -r doc/requirements.txt
@@ -201,7 +201,7 @@ In order to host a SparkML model in SageMaker, it should be serialized with ``ML
201201

202202
For more information on MLeap, see https://github.com/combust/mleap .
203203

204-
Supported major version of Spark: 2.2 (MLeap version - 0.9.6)
204+
Supported major version of Spark: 2.4 (MLeap version - 0.9.6)
205205

206206
Here is an example on how to create an instance of ``SparkMLModel`` class and use ``deploy()`` method to create an
207207
endpoint which can be used to perform prediction against your trained SparkML Model.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.9.3.dev0
1+
2.14.1.dev0

doc/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ You can install all necessary for this feature dependencies using pip:
672672
For more detailed examples of running hyperparameter tuning jobs, see:
673673

674674
- `Using the TensorFlow estimator with hyperparameter tuning <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/hyperparameter_tuning/tensorflow_mnist/hpo_tensorflow_mnist.ipynb>`__
675-
- `Bringing your own estimator for hyperparameter tuning <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/hyperparameter_tuning/r_bring_your_own/hpo_r_bring_your_own.ipynb>`__
675+
- `Bringing your own estimator for hyperparameter tuning <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/hyperparameter_tuning/r_bring_your_own/tune_r_bring_your_own.ipynb>`__
676676
- `Analyzing results <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/hyperparameter_tuning/analyze_results/HPO_Analyze_TuningJob_Results.ipynb>`__
677677

678678
You can also find these notebooks in the **Hyperprameter Tuning** section of the **SageMaker Examples** section in a notebook instance.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def read_version():
6161
extras["all"],
6262
"tox",
6363
"flake8",
64-
"pytest",
64+
"pytest<6.1.0",
6565
"pytest-cov",
6666
"pytest-rerunfailures",
6767
"pytest-xdist",

src/sagemaker/algorithm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import sagemaker.parameter
1818
from sagemaker import vpc_utils
1919
from sagemaker.deserializers import BytesDeserializer
20+
from sagemaker.deprecations import removed_kwargs
2021
from sagemaker.estimator import EstimatorBase
2122
from sagemaker.serializers import IdentitySerializer
2223
from sagemaker.transformer import Transformer
@@ -291,6 +292,9 @@ def create_model(
291292
Returns:
292293
a Model ready for deployment.
293294
"""
295+
removed_kwargs("content_type", kwargs)
296+
removed_kwargs("accept", kwargs)
297+
294298
if predictor_cls is None:
295299

296300
def predict_wrapper(endpoint, session):

src/sagemaker/amazon/amazon_estimator.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from sagemaker.amazon import validation
2424
from sagemaker.amazon.hyperparameter import Hyperparameter as hp # noqa
2525
from sagemaker.amazon.common import write_numpy_to_dense_tensor
26+
from sagemaker.deprecations import renamed_warning
2627
from sagemaker.estimator import EstimatorBase, _TrainingJob
2728
from sagemaker.inputs import FileSystemInput, TrainingInput
2829
from sagemaker.utils import sagemaker_timestamp
@@ -454,3 +455,22 @@ def upload_numpy_to_s3_shards(
454455
s3.Object(bucket, key_prefix + file).delete()
455456
finally:
456457
raise ex
458+
459+
460+
def get_image_uri(region_name, repo_name, repo_version=1):
461+
"""Deprecated method. Please use sagemaker.image_uris.retrieve().
462+
463+
Args:
464+
region_name: name of the region
465+
repo_name: name of the repo (e.g. xgboost)
466+
repo_version: version of the repo
467+
468+
Returns:
469+
the image uri
470+
"""
471+
renamed_warning("The method get_image_uri")
472+
return image_uris.retrieve(
473+
framework=repo_name,
474+
region=region_name,
475+
version=repo_version,
476+
)

src/sagemaker/amazon/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import numpy as np
2222

2323
from sagemaker.amazon.record_pb2 import Record
24+
from sagemaker.deprecations import deprecated_class
2425
from sagemaker.deserializers import BaseDeserializer
2526
from sagemaker.serializers import BaseSerializer
2627
from sagemaker.utils import DeferredError
@@ -298,3 +299,7 @@ def _resolve_type(dtype):
298299
if dtype == np.dtype("float32"):
299300
return "Float32"
300301
raise ValueError("Unsupported dtype {} on array".format(dtype))
302+
303+
304+
numpy_to_record_serializer = deprecated_class(RecordSerializer, "numpy_to_record_serializer")
305+
record_deserializer = deprecated_class(RecordDeserializer, "record_deserializer")

src/sagemaker/content_types.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2020 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+
"""Deprecated content type constants. Just use the mime type strings."""
14+
from __future__ import absolute_import
15+
16+
import deprecations
17+
18+
deprecations.removed_warning("The sagemaker.content_types module")
19+
20+
CONTENT_TYPE_JSON = "application/json"
21+
CONTENT_TYPE_CSV = "text/csv"
22+
CONTENT_TYPE_OCTET_STREAM = "application/octet-stream"
23+
CONTENT_TYPE_NPY = "application/x-npy"

src/sagemaker/deprecations.py

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Copyright 2020 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+
"""Module for deprecation abstractions."""
14+
from __future__ import absolute_import
15+
16+
import logging
17+
import warnings
18+
19+
logging.captureWarnings(True)
20+
21+
22+
def _warn(msg):
23+
"""Generic warning raiser referencing V2
24+
25+
Args:
26+
phrase: The phrase to include in the warning.
27+
"""
28+
warnings.warn(
29+
f"{msg} in sagemaker>=2.\n"
30+
"See: https://sagemaker.readthedocs.io/en/stable/v2.html for details.",
31+
DeprecationWarning,
32+
stacklevel=2,
33+
)
34+
35+
36+
def removed_warning(phrase):
37+
"""Raise a warning for a no-op in sagemaker>=2
38+
39+
Args:
40+
phrase: the prefix phrase of the warning message.
41+
"""
42+
_warn(f"{phrase} is a no-op")
43+
44+
45+
def renamed_warning(phrase):
46+
"""Raise a warning for a rename in sagemaker>=2
47+
48+
Args:
49+
phrase: the prefix phrase of the warning message.
50+
"""
51+
_warn(f"{phrase} has been renamed")
52+
53+
54+
def renamed_kwargs(old_name, new_name, value, kwargs):
55+
"""Checks if the deprecated argument is in kwargs
56+
57+
Raises warning, if present.
58+
59+
Args:
60+
old_name: name of deprecated argument
61+
new_name: name of the new argument
62+
value: value associated with new name, if supplied
63+
kwargs: keyword arguments dict
64+
65+
Returns:
66+
value of the keyword argument, if present
67+
"""
68+
if old_name in kwargs:
69+
value = kwargs.get(old_name, value)
70+
kwargs[new_name] = value
71+
renamed_warning(old_name)
72+
return value
73+
74+
75+
def removed_arg(name, arg):
76+
"""Checks if the deprecated argument is populated.
77+
78+
Raises warning, if not None.
79+
80+
Args:
81+
name: name of deprecated argument
82+
arg: the argument to check
83+
"""
84+
if arg is not None:
85+
removed_warning(name)
86+
87+
88+
def removed_kwargs(name, kwargs):
89+
"""Checks if the deprecated argument is in kwargs
90+
91+
Raises warning, if present.
92+
93+
Args:
94+
name: name of deprecated argument
95+
kwargs: keyword arguments dict
96+
"""
97+
if name in kwargs:
98+
removed_warning(name)
99+
100+
101+
def removed_function(name):
102+
"""A no-op deprecated function factory."""
103+
104+
def func(*args, **kwargs): # pylint: disable=W0613
105+
removed_warning(f"The function {name}")
106+
107+
return func
108+
109+
110+
def deprecated_function(func, name):
111+
"""Wrap a function with a deprecation warning.
112+
113+
Args:
114+
func: Function to wrap in a deprecation warning.
115+
name: The name that has been deprecated.
116+
117+
Returns:
118+
The modified function
119+
"""
120+
121+
def deprecate(*args, **kwargs):
122+
renamed_warning(f"The {name}")
123+
return func(*args, **kwargs)
124+
125+
return deprecate
126+
127+
128+
def deprecated_serialize(instance, name):
129+
"""Modifies a serializer instance serialize method.
130+
131+
Args:
132+
instance: Instance to modify serialize method.
133+
name: The name that has been deprecated.
134+
135+
Returns:
136+
The modified instance
137+
"""
138+
instance.serialize = deprecated_function(instance.serialize, name)
139+
return instance
140+
141+
142+
def deprecated_deserialize(instance, name):
143+
"""Modifies a deserializer instance deserialize method.
144+
145+
Args:
146+
instance: Instance to modify deserialize method.
147+
name: The name that has been deprecated.
148+
149+
Returns:
150+
The modified instance
151+
"""
152+
instance.deserialize = deprecated_function(instance.deserialize, name)
153+
return instance
154+
155+
156+
def deprecated_class(cls, name):
157+
"""Returns a class based on super class with a deprecation warning.
158+
159+
Args:
160+
cls: The class to derive with a deprecation warning on __init__
161+
name: The name of the class.
162+
163+
Returns:
164+
The modified class.
165+
"""
166+
167+
class DeprecatedClass(cls):
168+
"""Provides a warning for the class name."""
169+
170+
def __init__(self, *args, **kwargs):
171+
"""Provides a warning for the class name."""
172+
renamed_warning(f"The class {name}")
173+
super(DeprecatedClass, self).__init__(*args, **kwargs)
174+
175+
return DeprecatedClass

0 commit comments

Comments
 (0)