Skip to content

Commit 49ec409

Browse files
Dipankar Patrodpatro
authored andcommitted
documentation: Adding Remote Function updates
* Add remote function related classes and method specifications * Update Configuration File specification to include remote function function as supported SageMaker capability.
1 parent 93006f3 commit 49ec409

File tree

2 files changed

+97
-3
lines changed

2 files changed

+97
-3
lines changed

doc/overview.rst

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,31 @@ 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: '366666666666.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::366666666666: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': 'yourTagKey', 'Value': 'yourTagValue'}
2048+
VolumeKmsKeyId: 'yourkmskeyid'
20242049
20252050
Configuration file locations
20262051
============================
@@ -2170,8 +2195,8 @@ types support setting defaults with a configuration file.
21702195
- Tags
21712196
- Enable inter-container traffic encryption
21722197
2173-
List of APIs supported
2174-
----------------------
2198+
List of APIs and SDK capabilities supported
2199+
-------------------------------------------
21752200
21762201
Default values for the supported parameters of these APIs apply to
21772202
all create and update calls for that API. For example, if a supported
@@ -2202,6 +2227,10 @@ configuration file.
22022227
Hyperparameter Tuning Job: Supported indirectly via ``TrainingJob`` API. While this API is not directly supported, it includes the training job definition as a parameter.
22032228
If you provide defaults for this parameter as part of the ``TrainingJob`` API, these defaults are also used for Hyperparameter Tuning Job.
22042229
2230+
The following goups of SDK capabilities support defaults with a configuration file.
2231+
2232+
- Remote Function ``@remote decorator``, ``RemoteExecutor```
2233+
22052234
Configuration file resolution
22062235
=============================
22072236
@@ -2411,7 +2440,46 @@ specifically the contents of ``'body': b'{...}`` .
24112440
24122441
<TIMESTAMP> botocore.endpoint [DEBUG] Making request for OperationModel(name=<OPERATION_NAME>) with params: {'url_path': ...,
24132442
'query_string': ..., 'method': 'POST', 'headers': {...}, 'body': b'{...}', 'url': 'https://api.sagemaker.us-west-2.amazonaws.com/',
2414-
'context': {...}}
2443+
'context': {...}}cd
2444+
2445+
2446+
************************************************************
2447+
Run Machine Learning code on SageMaker using remote function
2448+
************************************************************
2449+
2450+
You can seamlessly integrate your local machine language (ML) code to run in a Amazon SageMaker Training job by wrapping
2451+
your code inside a @remote decorator as shown in the following code example.
2452+
2453+
.. code-block:: python
2454+
2455+
from sagemaker.remote_function import remote
2456+
import numpy as np
2457+
2458+
@remote(instance_type="ml.m5.large")
2459+
def matrix_multiply(a, b):
2460+
return np.matmul(a, b)
2461+
2462+
a = np.array([[1, 0],
2463+
[0, 1]])
2464+
b = np.array([1, 2])
2465+
2466+
assert (matrix_multiply(a, b) == np.array([1,2])).all()
2467+
2468+
The SageMaker Python SDK will automatically translate your existing workspace environment and any associated data
2469+
processing code and datasets into a SageMaker Training job that runs on the SageMaker Training platform.
2470+
You can also activate a persistent cache feature, which will further reduce job start up latency by caching previously
2471+
downloaded dependency packages. This reduction in job latency is greater than the reduction in latency from using
2472+
SageMaker managed warm pools alone. The following sections show you how to wrap your local ML code and tailor your
2473+
experience for your use case including customizing your environment and integrating with SageMaker Experiments.
2474+
2475+
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.
2476+
2477+
Follow is the API specification for methods and classes related to remote function feature.
2478+
2479+
.. toctree::
2480+
:maxdepth: 1
2481+
2482+
remote_function/sagemaker.remote_function.rst
24152483
24162484
***
24172485
FAQ
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

0 commit comments

Comments
 (0)