Skip to content

Commit 12dc811

Browse files
committed
doc: add link to framework-related parent classes to clarify **kwargs
This commit also fixes some minor Sphinx syntax issues in the docstrings.
1 parent 42e3f09 commit 12dc811

File tree

14 files changed

+127
-29
lines changed

14 files changed

+127
-29
lines changed

src/sagemaker/chainer/estimator.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,20 @@ def __init__(
111111
image_name (str): If specified, the estimator will use this image
112112
for training and hosting, instead of selecting the appropriate
113113
SageMaker official image based on framework_version and
114-
py_version. It can be an ECR url or dockerhub image and tag. ..
115-
admonition:: Examples
114+
py_version. It can be an ECR url or dockerhub image and tag.
115+
116+
Examples
117+
* ``123412341234.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0``
118+
* ``custom-image:latest``
116119
117-
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
118-
custom-image:latest.
119120
**kwargs: Additional kwargs passed to the
120121
:class:`~sagemaker.estimator.Framework` constructor.
122+
123+
.. tip::
124+
125+
You can find additional parameters for initializing this class at
126+
:class:`~sagemaker.estimator.Framework` and
127+
:class:`~sagemaker.estimator.EstimatorBase`.
121128
"""
122129
if framework_version is None:
123130
logger.warning(empty_framework_version_warning(CHAINER_VERSION, self.LATEST_VERSION))

src/sagemaker/chainer/model.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -93,8 +93,14 @@ def __init__(
9393
model_server_workers (int): Optional. The number of worker processes
9494
used by the inference server. If None, server will use one
9595
worker per vCPU.
96-
**kwargs: Keyword arguments passed to the ``FrameworkModel``
97-
initializer.
96+
**kwargs: Keyword arguments passed to the
97+
:class:`~sagemaker.model.FrameworkModel` initializer.
98+
99+
.. tip::
100+
101+
You can find additional parameters for initializing this class at
102+
:class:`~sagemaker.model.FrameworkModel` and
103+
:class:`~sagemaker.model.Model`.
98104
"""
99105
super(ChainerModel, self).__init__(
100106
model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs

src/sagemaker/mxnet/estimator.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,22 @@ def __init__(
9090
image_name (str): If specified, the estimator will use this image for training and
9191
hosting, instead of selecting the appropriate SageMaker official image based on
9292
framework_version and py_version. It can be an ECR url or dockerhub image and tag.
93+
9394
Examples:
94-
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
95-
custom-image:latest.
95+
* ``123412341234.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0``
96+
* ``custom-image:latest``
9697
9798
distributions (dict): A dictionary with information on how to run distributed
9899
training (default: None). To have parameter servers launched for training,
99100
set this value to be ``{'parameter_server': {'enabled': True}}``.
100101
**kwargs: Additional kwargs passed to the
101102
:class:`~sagemaker.estimator.Framework` constructor.
103+
104+
.. tip::
105+
106+
You can find additional parameters for initializing this class at
107+
:class:`~sagemaker.estimator.Framework` and
108+
:class:`~sagemaker.estimator.EstimatorBase`.
102109
"""
103110
if framework_version is None:
104111
logger.warning(empty_framework_version_warning(MXNET_VERSION, self.LATEST_VERSION))
@@ -161,8 +168,10 @@ def create_model(
161168
role from the Estimator will be used.
162169
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on
163170
the model. Default: use subnets and security groups from this Estimator.
171+
164172
* 'Subnets' (list[str]): List of subnet ids.
165173
* 'SecurityGroupIds' (list[str]): List of security group ids.
174+
166175
entry_point (str): Path (absolute or relative) to the local Python source file which
167176
should be executed as the entry point to training. If not specified, the training
168177
entry point is used.
@@ -175,10 +184,13 @@ def create_model(
175184
image_name (str): If specified, the estimator will use this image for hosting, instead
176185
of selecting the appropriate SageMaker official image based on framework_version
177186
and py_version. It can be an ECR url or dockerhub image and tag.
187+
178188
Examples:
179-
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
180-
custom-image:latest.
181-
**kwargs: Additional kwargs passed to the MXNetModel constructor.
189+
* ``123412341234.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0``
190+
* ``custom-image:latest``
191+
192+
**kwargs: Additional kwargs passed to the :class:`~sagemaker.mxnet.model.MXNetModel`
193+
constructor.
182194
183195
Returns:
184196
sagemaker.mxnet.model.MXNetModel: A SageMaker ``MXNetModel`` object.

src/sagemaker/mxnet/model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -96,6 +96,12 @@ def __init__(
9696
worker per vCPU.
9797
**kwargs: Keyword arguments passed to the ``FrameworkModel``
9898
initializer.
99+
100+
.. tip::
101+
102+
You can find additional parameters for initializing this class at
103+
:class:`~sagemaker.model.FrameworkModel` and
104+
:class:`~sagemaker.model.Model`.
99105
"""
100106
super(MXNetModel, self).__init__(
101107
model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs

src/sagemaker/pytorch/estimator.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,19 @@ def __init__(
8989
for training and hosting, instead of selecting the appropriate
9090
SageMaker official image based on framework_version and
9191
py_version. It can be an ECR url or dockerhub image and tag.
92+
9293
Examples:
93-
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
94-
custom-image:latest.
94+
* ``123412341234.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0``
95+
* ``custom-image:latest``
96+
9597
**kwargs: Additional kwargs passed to the :class:`~sagemaker.estimator.Framework`
9698
constructor.
99+
100+
.. tip::
101+
102+
You can find additional parameters for initializing this class at
103+
:class:`~sagemaker.estimator.Framework` and
104+
:class:`~sagemaker.estimator.EstimatorBase`.
97105
"""
98106
if framework_version is None:
99107
logger.warning(empty_framework_version_warning(PYTORCH_VERSION, PYTORCH_VERSION))
@@ -146,7 +154,8 @@ def create_model(
146154
dependencies (list[str]): A list of paths to directories (absolute or relative) with
147155
any additional libraries that will be exported to the container.
148156
If not specified, the dependencies from training are used.
149-
**kwargs: Additional kwargs passed to the PyTorchModel constructor.
157+
**kwargs: Additional kwargs passed to the :class:`~sagemaker.pytorch.model.PyTorchModel`
158+
constructor.
150159
151160
Returns:
152161
sagemaker.pytorch.model.PyTorchModel: A SageMaker ``PyTorchModel``

src/sagemaker/pytorch/model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -97,6 +97,12 @@ def __init__(
9797
worker per vCPU.
9898
**kwargs: Keyword arguments passed to the ``FrameworkModel``
9999
initializer.
100+
101+
.. tip::
102+
103+
You can find additional parameters for initializing this class at
104+
:class:`~sagemaker.model.FrameworkModel` and
105+
:class:`~sagemaker.model.Model`.
100106
"""
101107
super(PyTorchModel, self).__init__(
102108
model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs

src/sagemaker/rl/estimator.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ def __init__(
131131
don't use an Amazon algorithm.
132132
**kwargs: Additional kwargs passed to the
133133
:class:`~sagemaker.estimator.Framework` constructor.
134+
135+
.. tip::
136+
137+
You can find additional parameters for initializing this class at
138+
:class:`~sagemaker.estimator.Framework` and
139+
:class:`~sagemaker.estimator.EstimatorBase`.
134140
"""
135141
self._validate_images_args(toolkit, toolkit_version, framework, image_name)
136142

@@ -174,8 +180,10 @@ def create_model(
174180
role from the Estimator will be used.
175181
vpc_config_override (dict[str, list[str]]): Optional override for VpcConfig set on
176182
the model. Default: use subnets and security groups from this Estimator.
183+
177184
* 'Subnets' (list[str]): List of subnet ids.
178185
* 'SecurityGroupIds' (list[str]): List of security group ids.
186+
179187
entry_point (str): Path (absolute or relative) to the Python source
180188
file which should be executed as the entry point for MXNet
181189
hosting. This should be compatible with Python 3.5 (default:
@@ -190,18 +198,20 @@ def create_model(
190198
folders will be copied to SageMaker in the same folder where the
191199
entry_point is copied. If the ```source_dir``` points to S3,
192200
code will be uploaded and the S3 location will be used instead.
193-
**kwargs: Additional kwargs passed to the FrameworkModel constructor.
201+
**kwargs: Additional kwargs passed to the :class:`~sagemaker.model.FrameworkModel`
202+
constructor.
194203
195204
Returns:
196205
sagemaker.model.FrameworkModel: Depending on input parameters returns
197206
one of the following:
198207
199-
* sagemaker.model.FrameworkModel - in case image_name was specified
208+
* :class:`~sagemaker.model.FrameworkModel` - if ``image_name`` was specified
200209
on the estimator;
201-
* sagemaker.mxnet.MXNetModel - if image_name wasn't specified and
202-
MXNet was used as RL backend;
203-
* sagemaker.tensorflow.serving.Model - if image_name wasn't specified and
204-
TensorFlow was used as RL backend.
210+
* :class:`~sagemaker.mxnet.MXNetModel` - if ``image_name`` wasn't specified and
211+
MXNet was used as the RL backend;
212+
* :class:`~sagemaker.tensorflow.serving.Model` - if ``image_name`` wasn't specified
213+
and TensorFlow was used as the RL backend.
214+
205215
Raises:
206216
ValueError: If image_name was not specified and framework enum is not valid.
207217
"""

src/sagemaker/sklearn/estimator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ def __init__(
9090
custom-image:latest.
9191
**kwargs: Additional kwargs passed to the
9292
:class:`~sagemaker.estimator.Framework` constructor.
93+
94+
.. tip::
95+
96+
You can find additional parameters for initializing this class at
97+
:class:`~sagemaker.estimator.Framework` and
98+
:class:`~sagemaker.estimator.EstimatorBase`.
9399
"""
94100
# SciKit-Learn does not support distributed training or training on GPU instance types.
95101
# Fail fast.

src/sagemaker/sklearn/model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -96,6 +96,12 @@ def __init__(
9696
worker per vCPU.
9797
**kwargs: Keyword arguments passed to the ``FrameworkModel``
9898
initializer.
99+
100+
.. tip::
101+
102+
You can find additional parameters for initializing this class at
103+
:class:`~sagemaker.model.FrameworkModel` and
104+
:class:`~sagemaker.model.Model`.
99105
"""
100106
super(SKLearnModel, self).__init__(
101107
model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs

src/sagemaker/tensorflow/estimator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ def __init__(
279279
}
280280
281281
**kwargs: Additional kwargs passed to the Framework constructor.
282+
283+
.. tip::
284+
285+
You can find additional parameters for initializing this class at
286+
:class:`~sagemaker.estimator.Framework` and
287+
:class:`~sagemaker.estimator.EstimatorBase`.
282288
"""
283289
if framework_version is None:
284290
logger.warning(fw.empty_framework_version_warning(TF_VERSION, self.LATEST_VERSION))
@@ -551,8 +557,8 @@ def create_model(
551557
If not specified and ``endpoint_type`` is 'tensorflow-serving', ``dependencies`` is
552558
set to ``None``.
553559
If ``endpoint_type`` is also ``None``, then the dependencies from training are used.
554-
**kwargs: Additional kwargs passed to ``sagemaker.tensorflow.serving.Model`` constructor
555-
and ``sagemaker.tensorflow.model.TensorFlowModel`` constructor.
560+
**kwargs: Additional kwargs passed to :class:`~sagemaker.tensorflow.serving.Model`
561+
and :class:`~sagemaker.tensorflow.model.TensorFlowModel` constructors.
556562
557563
Returns:
558564
sagemaker.tensorflow.model.TensorFlowModel or sagemaker.tensorflow.serving.Model: A

src/sagemaker/tensorflow/model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -94,6 +94,12 @@ def __init__(
9494
worker per vCPU.
9595
**kwargs: Keyword arguments passed to the ``FrameworkModel``
9696
initializer.
97+
98+
.. tip::
99+
100+
You can find additional parameters for initializing this class at
101+
:class:`~sagemaker.model.FrameworkModel` and
102+
:class:`~sagemaker.model.Model`.
97103
"""
98104
super(TensorFlowModel, self).__init__(
99105
model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs

src/sagemaker/tensorflow/serving.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -165,6 +165,12 @@ def __init__(
165165
SageMaker ``Session``. If specified, ``deploy()`` returns the
166166
result of invoking this function on the created endpoint name.
167167
**kwargs: Keyword arguments passed to the ``Model`` initializer.
168+
169+
.. tip::
170+
171+
You can find additional parameters for initializing this class at
172+
:class:`~sagemaker.model.FrameworkModel` and
173+
:class:`~sagemaker.model.Model`.
168174
"""
169175
super(Model, self).__init__(
170176
model_data=model_data,

src/sagemaker/xgboost/estimator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ def __init__(
100100
custom-image:latest.
101101
**kwargs: Additional kwargs passed to the
102102
:class:`~sagemaker.estimator.Framework` constructor.
103+
104+
.. tip::
105+
106+
You can find additional parameters for initializing this class at
107+
:class:`~sagemaker.estimator.Framework` and
108+
:class:`~sagemaker.estimator.EstimatorBase`.
103109
"""
104110
super(XGBoost, self).__init__(
105111
entry_point, source_dir, hyperparameters, image_name=image_name, **kwargs

src/sagemaker/xgboost/model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
# Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"). You
44
# may not use this file except in compliance with the License. A copy of
@@ -87,6 +87,12 @@ def __init__(
8787
model_server_workers (int): Optional. The number of worker processes used by the
8888
inference server. If None, server will use one worker per vCPU.
8989
**kwargs: Keyword arguments passed to the ``FrameworkModel`` initializer.
90+
91+
.. tip::
92+
93+
You can find additional parameters for initializing this class at
94+
:class:`~sagemaker.model.FrameworkModel` and
95+
:class:`~sagemaker.model.Model`.
9096
"""
9197
super(XGBoostModel, self).__init__(
9298
model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs

0 commit comments

Comments
 (0)