Skip to content

Commit 733f93d

Browse files
Merge branch 'master' into tf_2.7
2 parents 612e2f3 + a387c4c commit 733f93d

19 files changed

+580
-67
lines changed

.readthedocs.yml renamed to .readthedocs.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44

55
version: 2
66

7+
build:
8+
os: ubuntu-20.04
9+
tools:
10+
python: "3.9"
11+
12+
713
python:
8-
version: 3.9
914
install:
1015
- method: pip
1116
path: .
1217
- requirements: doc/requirements.txt
1318

19+
1420
sphinx:
1521
configuration: doc/conf.py
1622
fail_on_warning: true # http://www.sphinx-doc.org/en/master/man/sphinx-build.html#id6

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## v2.79.0 (2022-03-16)
4+
5+
### Features
6+
7+
* Inferentia Neuron support for HuggingFace
8+
* custom base job name for jumpstart models/estimators
9+
* Python 3.9 for readthedocs
10+
11+
### Bug Fixes and Other Changes
12+
13+
* container env generation for S3 URI and add test for the same
14+
15+
### Documentation Changes
16+
17+
* the SageMaker distributed data parallel v1.4.0 release
18+
* update sagemaker training compiler docstring
19+
* smddp doc update
20+
321
## v2.78.0 (2022-03-07)
422

523
### Features

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.78.1.dev0
1+
2.79.1.dev0

doc/overview.rst

+3
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ see `Model <https://sagemaker.readthedocs.io/en/stable/api/inference/model.html
757757
   entry_point="inference.py",
758758
   role=Session().get_caller_identity_arn(),
759759
   predictor_cls=Predictor,
760+
   enable_network_isolation=True,
760761
)
761762
762763
Save the output from deploying the model to a variable named
@@ -874,6 +875,7 @@ value is not set.
874875
    hyperparameters=default_hyperparameters,
875876
    instance_count=instance_count,
876877
    instance_type=training_instance_type,
878+
    enable_network_isolation=True,
877879
)
878880
879881
# Specify the S3 location of training data for the training channel
@@ -935,6 +937,7 @@ took your model to train.
935937
    image_uri=deploy_image_uri,
936938
    source_dir=deploy_script_uri,
937939
    endpoint_name=endpoint_name,
940+
    enable_network_isolation=True,
938941
)
939942
940943
Perform Inference on a SageMaker Endpoint

src/sagemaker/huggingface/model.py

+117
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from sagemaker.model import FrameworkModel, MODEL_SERVER_WORKERS_PARAM_NAME
2626
from sagemaker.predictor import Predictor
2727
from sagemaker.serializers import JSONSerializer
28+
from sagemaker.session import Session
2829

2930
logger = logging.getLogger("sagemaker")
3031

@@ -169,9 +170,125 @@ def __init__(
169170
super(HuggingFaceModel, self).__init__(
170171
model_data, image_uri, role, entry_point, predictor_cls=predictor_cls, **kwargs
171172
)
173+
self.sagemaker_session = self.sagemaker_session or Session()
172174

173175
self.model_server_workers = model_server_workers
174176

177+
# TODO: Remove the following function
178+
# botocore needs to add hugginface to the list of valid neo compilable frameworks.
179+
# Ideally with inferentia framewrok, call to .compile( ... ) method will create the image_uri.
180+
# currently, call to compile( ... ) method is causing `ValidationException`
181+
def deploy(
182+
self,
183+
initial_instance_count=None,
184+
instance_type=None,
185+
serializer=None,
186+
deserializer=None,
187+
accelerator_type=None,
188+
endpoint_name=None,
189+
tags=None,
190+
kms_key=None,
191+
wait=True,
192+
data_capture_config=None,
193+
async_inference_config=None,
194+
serverless_inference_config=None,
195+
**kwargs,
196+
):
197+
"""Deploy this ``Model`` to an ``Endpoint`` and optionally return a ``Predictor``.
198+
199+
Create a SageMaker ``Model`` and ``EndpointConfig``, and deploy an
200+
``Endpoint`` from this ``Model``. If ``self.predictor_cls`` is not None,
201+
this method returns a the result of invoking ``self.predictor_cls`` on
202+
the created endpoint name.
203+
204+
The name of the created model is accessible in the ``name`` field of
205+
this ``Model`` after deploy returns
206+
207+
The name of the created endpoint is accessible in the
208+
``endpoint_name`` field of this ``Model`` after deploy returns.
209+
210+
Args:
211+
initial_instance_count (int): The initial number of instances to run
212+
in the ``Endpoint`` created from this ``Model``. If not using
213+
serverless inference, then it need to be a number larger or equals
214+
to 1 (default: None)
215+
instance_type (str): The EC2 instance type to deploy this Model to.
216+
For example, 'ml.p2.xlarge', or 'local' for local mode. If not using
217+
serverless inference, then it is required to deploy a model.
218+
(default: None)
219+
serializer (:class:`~sagemaker.serializers.BaseSerializer`): A
220+
serializer object, used to encode data for an inference endpoint
221+
(default: None). If ``serializer`` is not None, then
222+
``serializer`` will override the default serializer. The
223+
default serializer is set by the ``predictor_cls``.
224+
deserializer (:class:`~sagemaker.deserializers.BaseDeserializer`): A
225+
deserializer object, used to decode data from an inference
226+
endpoint (default: None). If ``deserializer`` is not None, then
227+
``deserializer`` will override the default deserializer. The
228+
default deserializer is set by the ``predictor_cls``.
229+
accelerator_type (str): Type of Elastic Inference accelerator to
230+
deploy this model for model loading and inference, for example,
231+
'ml.eia1.medium'. If not specified, no Elastic Inference
232+
accelerator will be attached to the endpoint. For more
233+
information:
234+
https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html
235+
endpoint_name (str): The name of the endpoint to create (default:
236+
None). If not specified, a unique endpoint name will be created.
237+
tags (List[dict[str, str]]): The list of tags to attach to this
238+
specific endpoint.
239+
kms_key (str): The ARN of the KMS key that is used to encrypt the
240+
data on the storage volume attached to the instance hosting the
241+
endpoint.
242+
wait (bool): Whether the call should wait until the deployment of
243+
this model completes (default: True).
244+
data_capture_config (sagemaker.model_monitor.DataCaptureConfig): Specifies
245+
configuration related to Endpoint data capture for use with
246+
Amazon SageMaker Model Monitoring. Default: None.
247+
async_inference_config (sagemaker.model_monitor.AsyncInferenceConfig): Specifies
248+
configuration related to async endpoint. Use this configuration when trying
249+
to create async endpoint and make async inference. If empty config object
250+
passed through, will use default config to deploy async endpoint. Deploy a
251+
real-time endpoint if it's None. (default: None)
252+
serverless_inference_config (sagemaker.serverless.ServerlessInferenceConfig):
253+
Specifies configuration related to serverless endpoint. Use this configuration
254+
when trying to create serverless endpoint and make serverless inference. If
255+
empty object passed through, will use pre-defined values in
256+
``ServerlessInferenceConfig`` class to deploy serverless endpoint. Deploy an
257+
instance based endpoint if it's None. (default: None)
258+
Raises:
259+
ValueError: If arguments combination check failed in these circumstances:
260+
- If no role is specified or
261+
- If serverless inference config is not specified and instance type and instance
262+
count are also not specified or
263+
- If a wrong type of object is provided as serverless inference config or async
264+
inference config
265+
Returns:
266+
callable[string, sagemaker.session.Session] or None: Invocation of
267+
``self.predictor_cls`` on the created endpoint name, if ``self.predictor_cls``
268+
is not None. Otherwise, return None.
269+
"""
270+
271+
if not self.image_uri and instance_type.startswith("ml.inf"):
272+
self.image_uri = self.serving_image_uri(
273+
region_name=self.sagemaker_session.boto_session.region_name,
274+
instance_type=instance_type,
275+
)
276+
277+
return super(HuggingFaceModel, self).deploy(
278+
initial_instance_count,
279+
instance_type,
280+
serializer,
281+
deserializer,
282+
accelerator_type,
283+
endpoint_name,
284+
tags,
285+
kms_key,
286+
wait,
287+
data_capture_config,
288+
async_inference_config,
289+
serverless_inference_config,
290+
)
291+
175292
def register(
176293
self,
177294
content_types,

src/sagemaker/image_uri_config/autogluon.json

+128
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"training": {
33
"processors": ["cpu", "gpu"],
4+
"version_aliases": {
5+
"0.3": "0.3.2",
6+
"0.4": "0.4.0"
7+
},
48
"versions": {
59
"0.3.1": {
610
"registries": {
@@ -30,11 +34,73 @@
3034
},
3135
"repository": "autogluon-training",
3236
"py_versions": ["py37"]
37+
},
38+
"0.3.2": {
39+
"registries": {
40+
"af-south-1": "626614931356",
41+
"ap-east-1": "871362719292",
42+
"ap-northeast-1": "763104351884",
43+
"ap-northeast-2": "763104351884",
44+
"ap-northeast-3": "364406365360",
45+
"ap-south-1": "763104351884",
46+
"ap-southeast-1": "763104351884",
47+
"ap-southeast-2": "763104351884",
48+
"ca-central-1": "763104351884",
49+
"eu-central-1": "763104351884",
50+
"eu-north-1": "763104351884",
51+
"eu-west-1": "763104351884",
52+
"eu-west-2": "763104351884",
53+
"eu-west-3": "763104351884",
54+
"eu-south-1": "692866216735",
55+
"me-south-1": "217643126080",
56+
"sa-east-1": "763104351884",
57+
"us-east-1": "763104351884",
58+
"us-east-2": "763104351884",
59+
"us-gov-west-1": "442386744353",
60+
"us-iso-east-1": "886529160074",
61+
"us-west-1": "763104351884",
62+
"us-west-2": "763104351884"
63+
},
64+
"repository": "autogluon-training",
65+
"py_versions": ["py38"]
66+
},
67+
"0.4.0": {
68+
"registries": {
69+
"af-south-1": "626614931356",
70+
"ap-east-1": "871362719292",
71+
"ap-northeast-1": "763104351884",
72+
"ap-northeast-2": "763104351884",
73+
"ap-northeast-3": "364406365360",
74+
"ap-south-1": "763104351884",
75+
"ap-southeast-1": "763104351884",
76+
"ap-southeast-2": "763104351884",
77+
"ca-central-1": "763104351884",
78+
"eu-central-1": "763104351884",
79+
"eu-north-1": "763104351884",
80+
"eu-west-1": "763104351884",
81+
"eu-west-2": "763104351884",
82+
"eu-west-3": "763104351884",
83+
"eu-south-1": "692866216735",
84+
"me-south-1": "217643126080",
85+
"sa-east-1": "763104351884",
86+
"us-east-1": "763104351884",
87+
"us-east-2": "763104351884",
88+
"us-gov-west-1": "442386744353",
89+
"us-iso-east-1": "886529160074",
90+
"us-west-1": "763104351884",
91+
"us-west-2": "763104351884"
92+
},
93+
"repository": "autogluon-training",
94+
"py_versions": ["py38"]
3395
}
3496
}
3597
},
3698
"inference": {
3799
"processors": ["cpu"],
100+
"version_aliases": {
101+
"0.3": "0.3.2",
102+
"0.4": "0.4.0"
103+
},
38104
"versions": {
39105
"0.3.1": {
40106
"registries": {
@@ -66,6 +132,68 @@
66132
},
67133
"repository": "autogluon-inference",
68134
"py_versions": ["py37"]
135+
},
136+
"0.3.2": {
137+
"registries": {
138+
"af-south-1": "626614931356",
139+
"ap-east-1": "871362719292",
140+
"ap-northeast-1": "763104351884",
141+
"ap-northeast-2": "763104351884",
142+
"ap-northeast-3": "364406365360",
143+
"ap-south-1": "763104351884",
144+
"ap-southeast-1": "763104351884",
145+
"ap-southeast-2": "763104351884",
146+
"ca-central-1": "763104351884",
147+
"cn-north-1": "727897471807",
148+
"cn-northwest-1": "727897471807",
149+
"eu-central-1": "763104351884",
150+
"eu-north-1": "763104351884",
151+
"eu-west-1": "763104351884",
152+
"eu-west-2": "763104351884",
153+
"eu-west-3": "763104351884",
154+
"eu-south-1": "692866216735",
155+
"me-south-1": "217643126080",
156+
"sa-east-1": "763104351884",
157+
"us-east-1": "763104351884",
158+
"us-east-2": "763104351884",
159+
"us-gov-west-1": "442386744353",
160+
"us-iso-east-1": "886529160074",
161+
"us-west-1": "763104351884",
162+
"us-west-2": "763104351884"
163+
},
164+
"repository": "autogluon-inference",
165+
"py_versions": ["py38"]
166+
},
167+
"0.4.0": {
168+
"registries": {
169+
"af-south-1": "626614931356",
170+
"ap-east-1": "871362719292",
171+
"ap-northeast-1": "763104351884",
172+
"ap-northeast-2": "763104351884",
173+
"ap-northeast-3": "364406365360",
174+
"ap-south-1": "763104351884",
175+
"ap-southeast-1": "763104351884",
176+
"ap-southeast-2": "763104351884",
177+
"ca-central-1": "763104351884",
178+
"cn-north-1": "727897471807",
179+
"cn-northwest-1": "727897471807",
180+
"eu-central-1": "763104351884",
181+
"eu-north-1": "763104351884",
182+
"eu-west-1": "763104351884",
183+
"eu-west-2": "763104351884",
184+
"eu-west-3": "763104351884",
185+
"eu-south-1": "692866216735",
186+
"me-south-1": "217643126080",
187+
"sa-east-1": "763104351884",
188+
"us-east-1": "763104351884",
189+
"us-east-2": "763104351884",
190+
"us-gov-west-1": "442386744353",
191+
"us-iso-east-1": "886529160074",
192+
"us-west-1": "763104351884",
193+
"us-west-2": "763104351884"
194+
},
195+
"repository": "autogluon-inference",
196+
"py_versions": ["py38"]
69197
}
70198
}
71199
}

0 commit comments

Comments
 (0)