Skip to content

Commit c604059

Browse files
Merge branch 'master' into master
2 parents da0b8f7 + 3ed0011 commit c604059

Some content is hidden

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

53 files changed

+1613
-476
lines changed

doc/frameworks/pytorch/using_pytorch.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,49 @@ Using third-party libraries
132132
---------------------------
133133

134134
When running your training script on SageMaker, it will have access to some pre-installed third-party libraries including ``torch``, ``torchvision``, and ``numpy``.
135-
For more information on the runtime environment, including specific package versions, see `SageMaker PyTorch Docker containers <https://github.com/aws/deep-learning-containers/tree/master/pytorch>`_.
136135

137136
If there are other packages you want to use with your script, you can include a ``requirements.txt`` file in the same directory as your training script to install other dependencies at runtime. Both ``requirements.txt`` and your training script should be put in the same folder. You must specify this folder in ``source_dir`` argument when creating PyTorch estimator.
138137

139138
The function of installing packages using ``requirements.txt`` is supported for all PyTorch versions during training. When serving a PyTorch model, support for this function varies with PyTorch versions. For PyTorch 1.3.1 or newer, ``requirements.txt`` must be under folder ``code``. The SageMaker PyTorch Estimator will automatically save ``code`` in ``model.tar.gz`` after training (assuming you set up your script and ``requirements.txt`` correctly as stipulated in the previous paragraph). In the case of bringing your own trained model for deployment, you must save ``requirements.txt`` under folder ``code`` in ``model.tar.gz`` yourself or specify it through ``dependencies``. For PyTorch 1.2.0, ``requirements.txt`` is not supported for inference. For PyTorch 0.4.0 to 1.1.0, ``requirements.txt`` must be in ``source_dir``.
140139

141140
A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``. You can also specify the version of an item to install. For information about the format of a ``requirements.txt`` file, see `Requirements Files <https://pip.pypa.io/en/stable/user_guide/#requirements-files>`__ in the pip documentation.
142141

142+
If you were to use your own custom Docker Image, the `SageMaker Python SDK` and the `SageMaker Training Toolkit <https://github.com/aws/sagemaker-training-toolkit/>`__ need to be installed.
143+
144+
To do so, you can add the following lines to your ``requirements.txt`` file:
145+
146+
.. code:: text
147+
148+
sagemaker
149+
sagemaker-training
150+
151+
Deep Learning Framework-Specific SageMaker Toolkits and Containers
152+
------------------------------------------------------------------
153+
154+
Framework-specific Toolkits exist. You might want to use them in your applications for framework-specific features.
155+
156+
For Training Toolkits, see:
157+
158+
- `SageMaker PyTorch Training Toolkit <https://github.com/aws/sagemaker-pytorch-training-toolkit>`__
159+
- `SageMaker MXNet Training Toolkit <https://github.com/aws/sagemaker-mxnet-training-toolkit>`__
160+
- `SageMaker TensorFlow Training Toolkit <https://github.com/aws/sagemaker-tensorflow-training-toolkit>`__
161+
162+
For Inference Toolkits, see:
163+
164+
- `SageMaker PyTorch Inference Toolkit <https://github.com/aws/sagemaker-pytorch-inference-toolkit>`__
165+
- `SageMaker MXNet Inference Toolkit <https://github.com/aws/sagemaker-mxnet-training-toolkit>`__
166+
- `SageMaker TensorFlow Inference Toolkit <https://github.com/aws/sagemaker-tensorflow-inference-toolkit>`__
167+
- `SageMaker HuggingFace Inference Toolkit <https://github.com/aws/sagemaker-huggingface-inference-toolkit>`__
168+
169+
Moreover, for more information on the container runtime environment, including specific framework versions and configurations,
170+
see `AWS Deep Learning Containers <https://github.com/aws/deep-learning-containers/>`_. More specifically, see:
171+
172+
- `Images for PyTorch <https://github.com/aws/deep-learning-containers/tree/master/pytorch>`__
173+
- `Images for MXNet <https://github.com/aws/deep-learning-containers/tree/master/mxnet>`__
174+
- `Images for TensorFlow <https://github.com/aws/deep-learning-containers/tree/master/tensorflow>`__
175+
- `Images for HuggingFace <https://github.com/aws/deep-learning-containers/tree/master/huggingface>`__
176+
177+
143178
Create an Estimator
144179
===================
145180

inference-experience-dev-tester.sh

Lines changed: 0 additions & 53 deletions
This file was deleted.

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ testpaths = tests
88
test=pytest
99

1010
[metadata]
11-
description-file = README.rst
12-
license_file = LICENSE.txt
11+
description_file = README.rst
12+
license_files = LICENSE.txt
1313

1414
[wheel]
1515
universal = 1

src/sagemaker/chainer/model.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@ def register(
265265
)
266266

267267
def prepare_container_def(
268-
self, instance_type=None, accelerator_type=None, serverless_inference_config=None
268+
self,
269+
instance_type=None,
270+
accelerator_type=None,
271+
serverless_inference_config=None,
272+
accept_eula=None,
269273
):
270274
"""Return a container definition with framework configuration set in model environment.
271275
@@ -278,6 +282,11 @@ def prepare_container_def(
278282
serverless_inference_config (sagemaker.serverless.ServerlessInferenceConfig):
279283
Specifies configuration related to serverless endpoint. Instance type is
280284
not provided in serverless inference. So this is used to find image URIs.
285+
accept_eula (bool): For models that require a Model Access Config, specify True or
286+
False to indicate whether model terms of use have been accepted.
287+
The `accept_eula` value must be explicitly defined as `True` in order to
288+
accept the end-user license agreement (EULA) that some
289+
models require. (Default: None).
281290
282291
Returns:
283292
dict[str, str]: A container definition object usable with the
@@ -307,7 +316,12 @@ def prepare_container_def(
307316
deploy_env[MODEL_SERVER_WORKERS_PARAM_NAME.upper()] = to_string(
308317
self.model_server_workers
309318
)
310-
return sagemaker.container_def(deploy_image, self.model_data, deploy_env)
319+
return sagemaker.container_def(
320+
deploy_image,
321+
self.model_data,
322+
deploy_env,
323+
accept_eula=accept_eula,
324+
)
311325

312326
def serving_image_uri(
313327
self, region_name, instance_type, accelerator_type=None, serverless_inference_config=None

src/sagemaker/djl_inference/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ def prepare_container_def(
733733
instance_type=None,
734734
accelerator_type=None,
735735
serverless_inference_config=None,
736+
accept_eula=None,
736737
): # pylint: disable=unused-argument
737738
"""A container definition with framework configuration set in model environment variables.
738739

src/sagemaker/fw_utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,6 @@ def validate_mp_config(config):
327327
ValueError: If any of the keys have incorrect values.
328328
"""
329329

330-
if "partitions" not in config:
331-
raise ValueError("'partitions' is a required parameter.")
332-
333330
def validate_positive(key):
334331
try:
335332
if not isinstance(config[key], int) or config[key] < 1:

src/sagemaker/huggingface/model.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ def prepare_container_def(
465465
accelerator_type=None,
466466
serverless_inference_config=None,
467467
inference_tool=None,
468+
accept_eula=None,
468469
):
469470
"""A container definition with framework configuration set in model environment variables.
470471
@@ -479,6 +480,11 @@ def prepare_container_def(
479480
not provided in serverless inference. So this is used to find image URIs.
480481
inference_tool (str): the tool that will be used to aid in the inference.
481482
Valid values: "neuron, neuronx, None" (default: None).
483+
accept_eula (bool): For models that require a Model Access Config, specify True or
484+
False to indicate whether model terms of use have been accepted.
485+
The `accept_eula` value must be explicitly defined as `True` in order to
486+
accept the end-user license agreement (EULA) that some
487+
models require. (Default: None).
482488
483489
Returns:
484490
dict[str, str]: A container definition object usable with the
@@ -510,7 +516,10 @@ def prepare_container_def(
510516
self.model_server_workers
511517
)
512518
return sagemaker.container_def(
513-
deploy_image, self.repacked_model_data or self.model_data, deploy_env
519+
deploy_image,
520+
self.repacked_model_data or self.model_data,
521+
deploy_env,
522+
accept_eula=accept_eula,
514523
)
515524

516525
def serving_image_uri(

src/sagemaker/image_uri_config/djl-neuronx.json

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,123 +3,67 @@
33
"versions": {
44
"0.25.0": {
55
"registries": {
6-
"af-south-1": "626614931356",
7-
"il-central-1": "780543022126",
8-
"ap-east-1": "871362719292",
96
"ap-northeast-1": "763104351884",
10-
"ap-northeast-2": "763104351884",
11-
"ap-northeast-3": "364406365360",
127
"ap-south-1": "763104351884",
138
"ap-southeast-1": "763104351884",
149
"ap-southeast-2": "763104351884",
15-
"ap-southeast-3": "907027046896",
16-
"ca-central-1": "763104351884",
17-
"cn-north-1": "727897471807",
18-
"cn-northwest-1": "727897471807",
1910
"eu-central-1": "763104351884",
20-
"eu-north-1": "763104351884",
2111
"eu-west-1": "763104351884",
22-
"eu-west-2": "763104351884",
2312
"eu-west-3": "763104351884",
24-
"eu-south-1": "692866216735",
25-
"me-south-1": "217643126080",
2613
"sa-east-1": "763104351884",
2714
"us-east-1": "763104351884",
2815
"us-east-2": "763104351884",
29-
"us-west-1": "763104351884",
3016
"us-west-2": "763104351884"
3117
},
3218
"repository": "djl-inference",
3319
"tag_prefix": "0.25.0-neuronx-sdk2.15.0"
3420
},
3521
"0.24.0": {
3622
"registries": {
37-
"af-south-1": "626614931356",
38-
"il-central-1": "780543022126",
39-
"ap-east-1": "871362719292",
4023
"ap-northeast-1": "763104351884",
41-
"ap-northeast-2": "763104351884",
42-
"ap-northeast-3": "364406365360",
4324
"ap-south-1": "763104351884",
4425
"ap-southeast-1": "763104351884",
4526
"ap-southeast-2": "763104351884",
46-
"ap-southeast-3": "907027046896",
47-
"ca-central-1": "763104351884",
48-
"cn-north-1": "727897471807",
49-
"cn-northwest-1": "727897471807",
5027
"eu-central-1": "763104351884",
51-
"eu-north-1": "763104351884",
5228
"eu-west-1": "763104351884",
53-
"eu-west-2": "763104351884",
5429
"eu-west-3": "763104351884",
55-
"eu-south-1": "692866216735",
56-
"me-south-1": "217643126080",
5730
"sa-east-1": "763104351884",
5831
"us-east-1": "763104351884",
5932
"us-east-2": "763104351884",
60-
"us-west-1": "763104351884",
6133
"us-west-2": "763104351884"
6234
},
6335
"repository": "djl-inference",
6436
"tag_prefix": "0.24.0-neuronx-sdk2.14.1"
6537
},
6638
"0.23.0": {
6739
"registries": {
68-
"af-south-1": "626614931356",
69-
"il-central-1": "780543022126",
70-
"ap-east-1": "871362719292",
7140
"ap-northeast-1": "763104351884",
72-
"ap-northeast-2": "763104351884",
73-
"ap-northeast-3": "364406365360",
7441
"ap-south-1": "763104351884",
7542
"ap-southeast-1": "763104351884",
7643
"ap-southeast-2": "763104351884",
77-
"ap-southeast-3": "907027046896",
78-
"ca-central-1": "763104351884",
79-
"cn-north-1": "727897471807",
80-
"cn-northwest-1": "727897471807",
8144
"eu-central-1": "763104351884",
82-
"eu-north-1": "763104351884",
8345
"eu-west-1": "763104351884",
84-
"eu-west-2": "763104351884",
8546
"eu-west-3": "763104351884",
86-
"eu-south-1": "692866216735",
87-
"me-south-1": "217643126080",
8847
"sa-east-1": "763104351884",
8948
"us-east-1": "763104351884",
9049
"us-east-2": "763104351884",
91-
"us-west-1": "763104351884",
9250
"us-west-2": "763104351884"
9351
},
9452
"repository": "djl-inference",
9553
"tag_prefix": "0.23.0-neuronx-sdk2.12.0"
9654
},
9755
"0.22.1": {
9856
"registries": {
99-
"af-south-1": "626614931356",
100-
"il-central-1": "780543022126",
101-
"ap-east-1": "871362719292",
10257
"ap-northeast-1": "763104351884",
103-
"ap-northeast-2": "763104351884",
104-
"ap-northeast-3": "364406365360",
10558
"ap-south-1": "763104351884",
10659
"ap-southeast-1": "763104351884",
10760
"ap-southeast-2": "763104351884",
108-
"ap-southeast-3": "907027046896",
109-
"ca-central-1": "763104351884",
110-
"cn-north-1": "727897471807",
111-
"cn-northwest-1": "727897471807",
11261
"eu-central-1": "763104351884",
113-
"eu-north-1": "763104351884",
11462
"eu-west-1": "763104351884",
115-
"eu-west-2": "763104351884",
11663
"eu-west-3": "763104351884",
117-
"eu-south-1": "692866216735",
118-
"me-south-1": "217643126080",
11964
"sa-east-1": "763104351884",
12065
"us-east-1": "763104351884",
12166
"us-east-2": "763104351884",
122-
"us-west-1": "763104351884",
12367
"us-west-2": "763104351884"
12468
},
12569
"repository": "djl-inference",

src/sagemaker/jumpstart/constants.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"""This module stores constants related to SageMaker JumpStart."""
1414
from __future__ import absolute_import
1515
import logging
16+
import os
1617
from typing import Dict, Set, Type
1718
import boto3
1819
from sagemaker.base_deserializers import BaseDeserializer, JSONDeserializer
@@ -33,6 +34,8 @@
3334
from sagemaker.session import Session
3435

3536

37+
ENV_VARIABLE_DISABLE_JUMPSTART_LOGGING = "DISABLE_JUMPSTART_LOGGING"
38+
3639
JUMPSTART_LAUNCHED_REGIONS: Set[JumpStartLaunchedRegionInfo] = set(
3740
[
3841
JumpStartLaunchedRegionInfo(
@@ -209,6 +212,19 @@
209212

210213
JUMPSTART_LOGGER = logging.getLogger("sagemaker.jumpstart")
211214

215+
# disable logging if env var is set
216+
JUMPSTART_LOGGER.addHandler(
217+
type(
218+
"",
219+
(logging.StreamHandler,),
220+
{
221+
"emit": lambda self, *args, **kwargs: logging.StreamHandler.emit(self, *args, **kwargs)
222+
if not os.environ.get(ENV_VARIABLE_DISABLE_JUMPSTART_LOGGING)
223+
else None
224+
},
225+
)()
226+
)
227+
212228
try:
213229
DEFAULT_JUMPSTART_SAGEMAKER_SESSION = Session(
214230
boto3.Session(region_name=JUMPSTART_DEFAULT_REGION_NAME)

0 commit comments

Comments
 (0)