Skip to content

Commit a7b539a

Browse files
authored
doc: clarify that entry_point must be in the root of source_dir (if applicable) (#1528)
1 parent af3b54e commit a7b539a

File tree

15 files changed

+64
-46
lines changed

15 files changed

+64
-46
lines changed

src/sagemaker/chainer/estimator.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def __init__(
7676
Args:
7777
entry_point (str): Path (absolute or relative) to the Python source
7878
file which should be executed as the entry point to training.
79-
This should be compatible with either Python 2.7 or Python 3.5.
79+
If ``source_dir`` is specified, then ``entry_point``
80+
must point to a file located at the root of ``source_dir``.
8081
use_mpi (bool): If true, entry point is run as an MPI script. By
8182
default, the Chainer Framework runs the entry point with
8283
'mpirun' if more than one instance is used.
@@ -186,11 +187,14 @@ def create_model(
186187
role from the Estimator will be used.
187188
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on
188189
the model. Default: use subnets and security groups from this Estimator.
190+
189191
* 'Subnets' (list[str]): List of subnet ids.
190192
* 'SecurityGroupIds' (list[str]): List of security group ids.
193+
191194
entry_point (str): Path (absolute or relative) to the local Python source file which
192-
should be executed as the entry point to training. If not specified, the training
193-
entry point is used.
195+
should be executed as the entry point to training. If ``source_dir`` is specified,
196+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
197+
If not specified, the training entry point is used.
194198
source_dir (str): Path (absolute or relative) to a directory with any other serving
195199
source code dependencies aside from the entry point file.
196200
If not specified, the model source directory from training is used.

src/sagemaker/chainer/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def __init__(
8585
might use the IAM role, if it needs to access an AWS resource.
8686
entry_point (str): Path (absolute or relative) to the Python source
8787
file which should be executed as the entry point to model
88-
hosting. This should be compatible with either Python 2.7 or
89-
Python 3.5.
88+
hosting. If ``source_dir`` is specified, then ``entry_point``
89+
must point to a file located at the root of ``source_dir``.
9090
image (str): A Docker image URI (default: None). If not specified, a
9191
default image for Chainer will be used.
9292
py_version (str): Python version you want to use for executing your

src/sagemaker/estimator.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1467,10 +1467,11 @@ def __init__(
14671467
Args:
14681468
entry_point (str): Path (absolute or relative) to the local Python
14691469
source file which should be executed as the entry point to
1470-
training. This should be compatible with either Python 2.7 or
1471-
Python 3.5. If 'git_config' is provided, 'entry_point' should be
1470+
training. If ``source_dir`` is specified, then ``entry_point``
1471+
must point to a file located at the root of ``source_dir``.
1472+
If 'git_config' is provided, 'entry_point' should be
14721473
a relative location to the Python source file in the Git repo.
1473-
Example
1474+
Example:
14741475
14751476
With the following GitHub repo directory structure:
14761477
@@ -1487,6 +1488,7 @@ def __init__(
14871488
when training on Amazon SageMaker. If 'git_config' is provided,
14881489
'source_dir' should be a relative location to a directory in the Git
14891490
repo.
1491+
14901492
.. admonition:: Example
14911493
14921494
With the following GitHub repo directory structure:
@@ -1968,8 +1970,9 @@ def transformer(
19681970
volume_kms_key (str): Optional. KMS key ID for encrypting the volume
19691971
attached to the ML compute instance (default: None).
19701972
entry_point (str): Path (absolute or relative) to the local Python source file which
1971-
should be executed as the entry point to training. If not specified, the training
1972-
entry point is used.
1973+
should be executed as the entry point to training. If ``source_dir`` is specified,
1974+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
1975+
If not specified, the training entry point is used.
19731976
vpc_config_override (dict[str, list[str]]): Optional override for
19741977
the VpcConfig set on the model.
19751978
Default: use subnets and security groups from this Estimator.

src/sagemaker/model.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -648,10 +648,11 @@ def __init__(
648648
resources on your behalf.
649649
entry_point (str): Path (absolute or relative) to the Python source
650650
file which should be executed as the entry point to model
651-
hosting. This should be compatible with either Python 2.7 or
652-
Python 3.5. If 'git_config' is provided, 'entry_point' should be
651+
hosting. If ``source_dir`` is specified, then ``entry_point``
652+
must point to a file located at the root of ``source_dir``.
653+
If 'git_config' is provided, 'entry_point' should be
653654
a relative location to the Python source file in the Git repo.
654-
Example
655+
Example:
655656
656657
With the following GitHub repo directory structure:
657658

src/sagemaker/mxnet/estimator.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def __init__(
7171
Args:
7272
entry_point (str): Path (absolute or relative) to the Python source
7373
file which should be executed as the entry point to training.
74-
This should be compatible with either Python 2.7 or Python 3.5.
74+
If ``source_dir`` is specified, then ``entry_point``
75+
must point to a file located at the root of ``source_dir``.
7576
source_dir (str): Path (absolute, relative or an S3 URI) to a directory
7677
with any other training source code dependencies aside from the entry
7778
point file (default: None). If ``source_dir`` is an S3 URI, it must
@@ -186,8 +187,9 @@ def create_model(
186187
* 'SecurityGroupIds' (list[str]): List of security group ids.
187188
188189
entry_point (str): Path (absolute or relative) to the local Python source file which
189-
should be executed as the entry point to training. If not specified, the training
190-
entry point is used.
190+
should be executed as the entry point to training. If ``source_dir`` is specified,
191+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
192+
If not specified, the training entry point is used.
191193
source_dir (str): Path (absolute or relative) to a directory with any other serving
192194
source code dependencies aside from the entry point file.
193195
If not specified, the model source directory from training is used.

src/sagemaker/mxnet/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def __init__(
8484
might use the IAM role, if it needs to access an AWS resource.
8585
entry_point (str): Path (absolute or relative) to the Python source
8686
file which should be executed as the entry point to model
87-
hosting. This should be compatible with either Python 2.7 or
88-
Python 3.5.
87+
hosting. If ``source_dir`` is specified, then ``entry_point``
88+
must point to a file located at the root of ``source_dir``.
8989
image (str): A Docker image URI (default: None). If not specified, a
9090
default image for MXNet will be used.
9191
py_version (str): Python version you want to use for executing your

src/sagemaker/pytorch/estimator.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def __init__(
6767
Args:
6868
entry_point (str): Path (absolute or relative) to the Python source
6969
file which should be executed as the entry point to training.
70-
This should be compatible with either Python 2.7 or Python 3.5.
70+
If ``source_dir`` is specified, then ``entry_point``
71+
must point to a file located at the root of ``source_dir``.
7172
source_dir (str): Path (absolute, relative or an S3 URI) to a directory
7273
with any other training source code dependencies aside from the entry
7374
point file (default: None). If ``source_dir`` is an S3 URI, it must
@@ -150,8 +151,9 @@ def create_model(
150151
* 'Subnets' (list[str]): List of subnet ids.
151152
* 'SecurityGroupIds' (list[str]): List of security group ids.
152153
entry_point (str): Path (absolute or relative) to the local Python source file which
153-
should be executed as the entry point to training. If not specified, the training
154-
entry point is used.
154+
should be executed as the entry point to training. If ``source_dir`` is specified,
155+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
156+
If not specified, the training entry point is used.
155157
source_dir (str): Path (absolute or relative) to a directory with any other serving
156158
source code dependencies aside from the entry point file.
157159
If not specified, the model source directory from training is used.

src/sagemaker/pytorch/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def __init__(
8585
might use the IAM role, if it needs to access an AWS resource.
8686
entry_point (str): Path (absolute or relative) to the Python source
8787
file which should be executed as the entry point to model
88-
hosting. This should be compatible with either Python 2.7 or
89-
Python 3.5.
88+
hosting. If ``source_dir`` is specified, then ``entry_point``
89+
must point to a file located at the root of ``source_dir``.
9090
image (str): A Docker image URI (default: None). If not specified, a
9191
default image for PyTorch will be used.
9292
py_version (str): Python version you want to use for executing your

src/sagemaker/rl/estimator.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def __init__(
100100
Args:
101101
entry_point (str): Path (absolute or relative) to the Python source
102102
file which should be executed as the entry point to training.
103-
This should be compatible with Python 3.5 for MXNet or Python
104-
3.6 for TensorFlow.
103+
If ``source_dir`` is specified, then ``entry_point``
104+
must point to a file located at the root of ``source_dir``.
105105
toolkit (sagemaker.rl.RLToolkit): RL toolkit you want to use for
106106
executing your model training code.
107107
toolkit_version (str): RL toolkit version you want to be use for
@@ -187,8 +187,8 @@ def create_model(
187187
188188
entry_point (str): Path (absolute or relative) to the Python source
189189
file which should be executed as the entry point for MXNet
190-
hosting. This should be compatible with Python 3.5 (default:
191-
self.entry_point)
190+
hosting (default: self.entry_point). If ``source_dir`` is specified,
191+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
192192
source_dir (str): Path (absolute or relative) to a directory with
193193
any other training source code dependencies aside from the entry
194194
point file (default: self.source_dir). Structure within this

src/sagemaker/sklearn/estimator.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def __init__(
6565
Args:
6666
entry_point (str): Path (absolute or relative) to the Python source
6767
file which should be executed as the entry point to training.
68-
This should be compatible with either Python 2.7 or Python 3.5.
68+
If ``source_dir`` is specified, then ``entry_point``
69+
must point to a file located at the root of ``source_dir``.
6970
framework_version (str): Scikit-learn version you want to use for
7071
executing your model training code. List of supported versions
7172
https://github.com/aws/sagemaker-python-sdk#sklearn-sagemaker-estimators

src/sagemaker/sklearn/model.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ def __init__(
8181
might use the IAM role, if it needs to access an AWS resource.
8282
entry_point (str): Path (absolute or relative) to the Python source
8383
file which should be executed as the entry point to model
84-
hosting. This should be compatible with either Python 2.7 or
85-
Python 3.5.
84+
hosting. If ``source_dir`` is specified, then ``entry_point``
85+
must point to a file located at the root of ``source_dir``.
8686
image (str): A Docker image URI (default: None). If not specified, a
8787
default image for Scikit-learn will be used.
8888
py_version (str): Python version you want to use for executing your
89-
model training code (default: 'py2').
89+
model training code (default: 'py3').
9090
framework_version (str): Scikit-learn version you want to use for
9191
executing your model training code.
9292
predictor_cls (callable[str, sagemaker.session.Session]): A function

src/sagemaker/tensorflow/estimator.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -558,19 +558,22 @@ def create_model(
558558
model_server_workers (int): Optional. The number of worker processes used by the
559559
inference server. If None, server will use one worker per vCPU.
560560
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on the
561-
model.
562-
Default: use subnets and security groups from this Estimator.
561+
model. Default: use subnets and security groups from this Estimator.
562+
563563
* 'Subnets' (list[str]): List of subnet ids.
564564
* 'SecurityGroupIds' (list[str]): List of security group ids.
565+
565566
endpoint_type (str): Optional. Selects the software stack used by the inference server.
566567
If not specified, the model will be configured to use the default
567568
SageMaker model server. If 'tensorflow-serving', the model will be configured to
568569
use the SageMaker Tensorflow Serving container.
569570
entry_point (str): Path (absolute or relative) to the local Python source file which
570-
should be executed as the entry point to training. If not specified and
571-
``endpoint_type`` is 'tensorflow-serving', no entry point is used. If
572-
``endpoint_type`` is also ``None``, then the training entry point is used.
573-
source_dir (str): Path (absolute or relative or an S3 URI ) to a directory with any
571+
should be executed as the entry point to training. If ``source_dir`` is specified,
572+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
573+
If not specified and ``endpoint_type`` is 'tensorflow-serving',
574+
no entry point is used. If ``endpoint_type`` is also ``None``,
575+
then the training entry point is used.
576+
source_dir (str): Path (absolute or relative or an S3 URI) to a directory with any
574577
other serving source code dependencies aside from the entry point file. If
575578
``source_dir`` is an S3 URI, it must point to a tar.gz file. If not specified
576579
and ``endpoint_type`` is 'tensorflow-serving', no source_dir is used. If
@@ -828,9 +831,11 @@ def transformer(
828831
If 'tensorflow-serving', the model will be configured to
829832
use the SageMaker Tensorflow Serving container.
830833
entry_point (str): Path (absolute or relative) to the local Python source file which
831-
should be executed as the entry point to training. If not specified and
832-
``endpoint_type`` is 'tensorflow-serving', no entry point is used. If
833-
``endpoint_type`` is also ``None``, then the training entry point is used.
834+
should be executed as the entry point to training. If ``source_dir`` is specified,
835+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
836+
If not specified and ``endpoint_type`` is 'tensorflow-serving',
837+
no entry point is used. If ``endpoint_type`` is also ``None``,
838+
then the training entry point is used.
834839
vpc_config_override (dict[str, list[str]]): Optional override for
835840
the VpcConfig set on the model.
836841
Default: use subnets and security groups from this Estimator.

src/sagemaker/tensorflow/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def __init__(
8282
might use the IAM role, if it needs to access an AWS resource.
8383
entry_point (str): Path (absolute or relative) to the Python source
8484
file which should be executed as the entry point to model
85-
hosting. This should be compatible with either Python 2.7 or
86-
Python 3.5.
85+
hosting. If ``source_dir`` is specified, then ``entry_point``
86+
must point to a file located at the root of ``source_dir``.
8787
image (str): A Docker image URI (default: None). If not specified, a
8888
default image for TensorFlow will be used.
8989
py_version (str): Python version you want to use for executing your

src/sagemaker/xgboost/estimator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def __init__(
7070
7171
Args:
7272
entry_point (str): Path (absolute or relative) to the Python source file which should
73-
be executed as the entry point to training.
74-
This should be compatible with either Python 2.7 or Python 3.5.
73+
be executed as the entry point to training. If ``source_dir`` is specified,
74+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
7575
framework_version (str): XGBoost version you want to use for executing your model
7676
training code. List of supported versions
7777
https://github.com/aws/sagemaker-python-sdk#xgboost-sagemaker-estimators

src/sagemaker/xgboost/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def __init__(
7474
training data and model artifacts. After the endpoint is created, the inference
7575
code might use the IAM role, if it needs to access an AWS resource.
7676
entry_point (str): Path (absolute or relative) to the Python source file which should
77-
be executed as the entry point to model hosting.
78-
This should be compatible with either Python 2.7 or Python 3.5.
77+
be executed as the entry point to model hosting. If ``source_dir`` is specified,
78+
then ``entry_point`` must point to a file located at the root of ``source_dir``.
7979
image (str): A Docker image URI (default: None). If not specified, a default image for
8080
XGBoos will be used.
8181
py_version (str): Python version you want to use for executing your model training code

0 commit comments

Comments
 (0)