Skip to content

Commit e63584c

Browse files
authored
Merge branch 'master' into master
2 parents 5715a33 + 9317e08 commit e63584c

File tree

9 files changed

+521
-127
lines changed

9 files changed

+521
-127
lines changed

doc/overview.rst

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,32 @@ set default values for. For the full schema, see ``sagemaker.config.config_schem
20212021
    Tags:
20222022
    - Key: 'tag_key'
20232023
      Value: 'tag_value'
2024+
PythonSDK:
2025+
Modules:
2026+
RemoteFunction:
2027+
Dependencies: 'path/to/requirements.txt'
2028+
EnableInterContainerTrafficEncryption: true
2029+
EnvironmentVariables: {'EnvVarKey': 'EnvVarValue'}
2030+
ImageUri: '555555555555.dkr.ecr.us-west-2.amazonaws.com/my-image:latest'
2031+
IncludeLocalWorkDir: true
2032+
InstanceType: 'ml.m5.large'
2033+
JobCondaEnvironment: 'your_conda_env'
2034+
PreExecutionCommands:
2035+
- 'command_1'
2036+
- 'command_2'
2037+
PreExecutionScript: 'path/to/script.sh'
2038+
RoleArn: 'arn:aws:iam::555555555555:role/MyRole'
2039+
S3KmsKeyId: 'yourkmskeyid'
2040+
S3RootUri: 's3://my-bucket/my-project'
2041+
VpcConfig:
2042+
SecurityGroupIds:
2043+
- 'sg123'
2044+
Subnets:
2045+
- 'subnet-1234'
2046+
Tags:
2047+
- Key: 'tag_key'
2048+
Value: 'tag_value'
2049+
VolumeKmsKeyId: 'yourkmskeyid'
20242050
20252051
Configuration file locations
20262052
============================
@@ -2170,8 +2196,8 @@ types support setting defaults with a configuration file.
21702196
- Tags
21712197
- Enable inter-container traffic encryption
21722198
2173-
List of APIs supported
2174-
----------------------
2199+
List of APIs and SDK capabilities supported
2200+
-------------------------------------------
21752201
21762202
Default values for the supported parameters of these APIs apply to
21772203
all create and update calls for that API. For example, if a supported
@@ -2202,6 +2228,10 @@ configuration file.
22022228
Hyperparameter Tuning Job: Supported indirectly via ``TrainingJob`` API. While this API is not directly supported, it includes the training job definition as a parameter.
22032229
If you provide defaults for this parameter as part of the ``TrainingJob`` API, these defaults are also used for Hyperparameter Tuning Job.
22042230
2231+
The following goups of SDK capabilities support defaults with a configuration file.
2232+
2233+
- Remote Function ``@remote decorator``, ``RemoteExecutor```
2234+
22052235
Configuration file resolution
22062236
=============================
22072237
@@ -2413,6 +2443,45 @@ specifically the contents of ``'body': b'{...}`` .
24132443
'query_string': ..., 'method': 'POST', 'headers': {...}, 'body': b'{...}', 'url': 'https://api.sagemaker.us-west-2.amazonaws.com/',
24142444
'context': {...}}
24152445
2446+
2447+
************************************************************
2448+
Run Machine Learning code on SageMaker using remote function
2449+
************************************************************
2450+
2451+
You can integrate your local machine language (ML) code to run in a Amazon SageMaker Training job by wrapping
2452+
your code inside a @remote decorator as shown in the following code example.
2453+
2454+
.. code-block:: python
2455+
2456+
from sagemaker.remote_function import remote
2457+
import numpy as np
2458+
2459+
@remote(instance_type="ml.m5.large")
2460+
def matrix_multiply(a, b):
2461+
return np.matmul(a, b)
2462+
2463+
a = np.array([[1, 0],
2464+
[0, 1]])
2465+
b = np.array([1, 2])
2466+
2467+
assert (matrix_multiply(a, b) == np.array([1,2])).all()
2468+
2469+
The SageMaker Python SDK will automatically translate your existing workspace environment and any associated data
2470+
processing code and datasets into a SageMaker Training job that runs on the SageMaker Training platform.
2471+
You can also activate a persistent cache feature, which will further reduce job start up latency by caching previously
2472+
downloaded dependency packages. This reduction in job latency is greater than the reduction in latency from using
2473+
SageMaker managed warm pools alone. The following sections show you how to wrap your local ML code and tailor your
2474+
experience for your use case including customizing your environment and integrating with SageMaker Experiments.
2475+
2476+
See the `Run your local code as a SageMaker Training job <https://docs.aws.amazon.com/sagemaker/latest/dg/train-remote-decorator.html>`__ for detailed developer guide.
2477+
2478+
Follow is the API specification for methods and classes related to remote function feature.
2479+
2480+
.. toctree::
2481+
:maxdepth: 1
2482+
2483+
remote_function/sagemaker.remote_function.rst
2484+
24162485
***
24172486
FAQ
24182487
***
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Remote function classes and methods specification
2+
=================================================
3+
4+
5+
@remote decorator
6+
-----------------
7+
8+
.. automethod:: sagemaker.remote_function.client.remote
9+
10+
11+
RemoteExcutor
12+
-------------
13+
14+
.. autoclass:: sagemaker.remote_function.RemoteExecutor
15+
:members:
16+
17+
18+
Future
19+
------
20+
21+
.. autoclass:: sagemaker.remote_function.client.Future
22+
:members:
23+
24+
.. automethod:: sagemaker.remote_function.client.list_futures
25+
26+
.. automethod:: sagemaker.remote_function.client.get_future

src/sagemaker/image_uri_config/tensorflow.json

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,8 @@
20212021
"2.8": "2.8.0",
20222022
"2.9": "2.9.2",
20232023
"2.10": "2.10.1",
2024-
"2.11": "2.11.0"
2024+
"2.11": "2.11.0",
2025+
"2.12": "2.12.0"
20252026
},
20262027
"versions": {
20272028
"1.10.0": {
@@ -3755,6 +3756,37 @@
37553756
"us-west-2": "763104351884"
37563757
},
37573758
"repository": "tensorflow-training"
3759+
},
3760+
"2.12.0": {
3761+
"py_versions": [
3762+
"py310"
3763+
],
3764+
"registries": {
3765+
"af-south-1": "626614931356",
3766+
"ap-east-1": "871362719292",
3767+
"ap-northeast-1": "763104351884",
3768+
"ap-northeast-2": "763104351884",
3769+
"ap-northeast-3": "364406365360",
3770+
"ap-south-1": "763104351884",
3771+
"ap-southeast-1": "763104351884",
3772+
"ap-southeast-2": "763104351884",
3773+
"ap-southeast-3": "907027046896",
3774+
"ap-southeast-4": "457447274322",
3775+
"ca-central-1": "763104351884",
3776+
"eu-central-1": "763104351884",
3777+
"eu-north-1": "763104351884",
3778+
"eu-south-1": "692866216735",
3779+
"eu-west-1": "763104351884",
3780+
"eu-west-2": "763104351884",
3781+
"eu-west-3": "763104351884",
3782+
"me-south-1": "217643126080",
3783+
"sa-east-1": "763104351884",
3784+
"us-east-1": "763104351884",
3785+
"us-east-2": "763104351884",
3786+
"us-west-1": "763104351884",
3787+
"us-west-2": "763104351884"
3788+
},
3789+
"repository": "tensorflow-training"
37583790
}
37593791
}
37603792
}

src/sagemaker/image_uris.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,15 @@ def _config_for_framework_and_scope(framework, image_scope, accelerator_type=Non
370370

371371
def _validate_instance_deprecation(framework, instance_type, version):
372372
"""Check if instance type is deprecated for a certain framework with a certain version"""
373-
if (
374-
framework == "pytorch"
375-
and _get_instance_type_family(instance_type) == "p2"
376-
and Version(version) >= Version("1.13")
377-
):
378-
raise ValueError(
379-
"P2 instances have been deprecated for sagemaker jobs with PyTorch 1.13 and above. "
380-
"For information about supported instance types please refer to "
381-
"https://aws.amazon.com/sagemaker/pricing/"
382-
)
373+
if _get_instance_type_family(instance_type) == "p2":
374+
if (framework == "pytorch" and Version(version) >= Version("1.13")) or (
375+
framework == "tensorflow" and Version(version) >= Version("2.12")
376+
):
377+
raise ValueError(
378+
"P2 instances have been deprecated for sagemaker jobs starting PyTorch 1.13 and TensorFlow 2.12"
379+
"For information about supported instance types please refer to "
380+
"https://aws.amazon.com/sagemaker/pricing/"
381+
)
383382

384383

385384
def _validate_for_suppported_frameworks_and_instance_type(framework, instance_type):

0 commit comments

Comments
 (0)