Skip to content

Commit d37581a

Browse files
authored
Fix docstrings warnings. (#620)
1 parent 4092b67 commit d37581a

File tree

8 files changed

+46
-25
lines changed

8 files changed

+46
-25
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __getattr__(cls, name):
6868
html_theme = 'default'
6969
else:
7070
html_theme = 'haiku'
71-
html_static_path = ['_static']
71+
html_static_path = []
7272
htmlhelp_basename = '%sdoc' % project
7373

7474
# Example configuration for intersphinx: refer to the Python standard library.

src/sagemaker/amazon/knn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(self, role, train_instance_count, train_instance_type, k, sample_si
6060
KNN are documented below.
6161
For further information on the AWS KNN algorithm,
6262
please consult AWS technical documentation: https://docs.aws.amazon.com/sagemaker/latest/dg/knn.html
63+
6364
Args:
6465
role (str): An AWS IAM role (either name or full ARN). The Amazon SageMaker training jobs and
6566
APIs that create Amazon SageMaker endpoints use this role to access

src/sagemaker/mxnet/estimator.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ def __init__(self, entry_point, source_dir=None, hyperparameters=None, py_versio
5858
For convenience, this accepts other types for keys and values, but ``str()`` will be called
5959
to convert them before training.
6060
py_version (str): Python version you want to use for executing your model training code (default: 'py2').
61-
One of 'py2' or 'py3'.
61+
One of 'py2' or 'py3'.
6262
framework_version (str): MXNet version you want to use for executing your model training code.
6363
List of supported versions https://github.com/aws/sagemaker-python-sdk#mxnet-sagemaker-estimators
6464
image_name (str): If specified, the estimator will use this image for training and hosting, instead of
6565
selecting the appropriate SageMaker official image based on framework_version and py_version. It can
6666
be an ECR url or dockerhub image and tag.
67-
Examples:
68-
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
69-
custom-image:latest.
67+
68+
Examples:
69+
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
70+
custom-image:latest.
7071
distributions (dict): A dictionary with information on how to run distributed training
7172
(default: None).
7273
**kwargs: Additional kwargs passed to the :class:`~sagemaker.estimator.Framework` constructor.
@@ -126,7 +127,7 @@ def _prepare_init_params_from_job_description(cls, job_details, model_channel_na
126127
model_channel_name (str): Name of the channel where pre-trained model data will be downloaded.
127128
128129
Returns:
129-
dictionary: The transformed init_params
130+
dictionary: The transformed init_params
130131
131132
"""
132133
init_params = super(MXNet, cls)._prepare_init_params_from_job_description(job_details, model_channel_name)

src/sagemaker/session.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def compile_model(self, input_model_config, output_model_config, role,
325325
326326
Args:
327327
input_model_config (dict): the trained model and the Amazon S3 location where it is stored.
328-
output_model_config (dict): - Identifies the Amazon S3 location where you want Amazon SageMaker Neo to save
328+
output_model_config (dict): Identifies the Amazon S3 location where you want Amazon SageMaker Neo to save
329329
the results of compilation job
330330
role (str): An AWS IAM role (either name or full ARN). The Amazon SageMaker Neo compilation jobs use this
331331
role to access model artifacts. You must grant sufficient permissions to this role.
@@ -550,6 +550,7 @@ def create_model(self, name, role, container_defs, vpc_config=None,
550550
the inference code. Amazon SageMaker uses this information to deploy the
551551
model in Amazon SageMaker. This method can also be used to create a Model for an Inference Pipeline
552552
if you pass the list of container definitions through the containers parameter.
553+
553554
Args:
554555
name (str): Name of the Amazon SageMaker ``Model`` to create.
555556
role (str): An AWS IAM role (either name or full ARN). The Amazon SageMaker training jobs and APIs
@@ -1177,6 +1178,7 @@ def logs_for_job(self, job_name, wait=False, poll=10): # noqa: C901 - suppress
11771178

11781179
def container_def(image, model_data_url=None, env=None):
11791180
"""Create a definition for executing a container as part of a SageMaker model.
1181+
11801182
Args:
11811183
image (str): Docker image to run for this container.
11821184
model_data_url (str): S3 URI of data required by this container,
@@ -1286,19 +1288,22 @@ def __init__(self, s3_data, distribution='FullyReplicated', compression=None,
12861288
``s3_data`` will be used to train. If 'ManifestFile' or 'AugmentedManifestFile', then ``s3_data``
12871289
defines a single s3 manifest file or augmented manifest file (respectively), listing the s3 data to
12881290
train on. Both the ManifestFile and AugmentedManifestFile formats are described in the SageMaker API
1289-
documentation: https://docs.aws.amazon.com/sagemaker/latest/dg/API_S3DataSource.html
1291+
documentation: https://docs.aws.amazon.com/sagemaker/latest/dg/API_S3DataSource.html
12901292
input_mode (str): Optional override for this channel's input mode (default: None). By default, channels will
12911293
use the input mode defined on ``sagemaker.estimator.EstimatorBase.input_mode``, but they will ignore
12921294
that setting if this parameter is set.
1293-
* None - Amazon SageMaker will use the input mode specified in the ``Estimator``.
1294-
* 'File' - Amazon SageMaker copies the training dataset from the S3 location to a local directory.
1295-
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a Unix-named pipe.
1295+
1296+
* None - Amazon SageMaker will use the input mode specified in the ``Estimator``.
1297+
* 'File' - Amazon SageMaker copies the training dataset from the S3 location to a local directory.
1298+
* 'Pipe' - Amazon SageMaker streams data directly from S3 to the container via a Unix-named pipe.
1299+
12961300
attribute_names (list[str]): A list of one or more attribute names to use that are found in a specified
12971301
AugmentedManifestFile.
12981302
shuffle_config (ShuffleConfig): If specified this configuration enables shuffling on this channel. See the
12991303
SageMaker API documentation for more info:
13001304
https://docs.aws.amazon.com/sagemaker/latest/dg/API_ShuffleConfig.html
13011305
"""
1306+
13021307
self.config = {
13031308
'DataSource': {
13041309
'S3DataSource': {

src/sagemaker/sparkml/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(self, endpoint, sagemaker_session=None):
3737
Initializes a SparkMLPredictor which should be used with SparkMLModel to perform predictions against SparkML
3838
models serialized via MLeap. The response is returned in text/csv format which is the default response format
3939
for SparkML Serving container.
40+
4041
Args:
4142
endpoint (str): The name of the endpoint to perform inference on.
4243
sagemaker_session (sagemaker.session.Session): Session object which manages interactions with
@@ -56,7 +57,8 @@ class SparkMLModel(Model):
5657
"""
5758

5859
def __init__(self, model_data, role=None, spark_version=2.2, sagemaker_session=None, **kwargs):
59-
"""Initialize a SparkMLModel..
60+
"""Initialize a SparkMLModel.
61+
6062
Args:
6163
model_data (str): The S3 location of a SageMaker model data ``.tar.gz`` file. For SparkML, this will be the
6264
output that has been produced by the Spark job after serializing the Model via MLeap.

src/sagemaker/tensorflow/estimator.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ class TensorFlow(Framework):
176176
def __init__(self, training_steps=None, evaluation_steps=None, checkpoint_path=None, py_version='py2',
177177
framework_version=None, model_dir=None, requirements_file='', image_name=None,
178178
script_mode=False, distributions=None, **kwargs):
179-
"""Initialize an ``TensorFlow`` estimator.
179+
"""Initialize a ``TensorFlow`` estimator.
180+
180181
Args:
181182
training_steps (int): Perform this many steps of training. `None`, the default means train forever.
182183
evaluation_steps (int): Perform this many steps of evaluation. `None`, the default means that evaluation
@@ -195,26 +196,36 @@ def __init__(self, training_steps=None, evaluation_steps=None, checkpoint_path=N
195196
image_name (str): If specified, the estimator will use this image for training and hosting, instead of
196197
selecting the appropriate SageMaker official image based on framework_version and py_version. It can
197198
be an ECR url or dockerhub image and tag.
198-
Examples:
199-
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
200-
custom-image:latest.
199+
200+
Examples:
201+
123.dkr.ecr.us-west-2.amazonaws.com/my-custom-image:1.0
202+
custom-image:latest.
201203
script_mode (bool): If set to True will the estimator will use the Script Mode containers (default: False).
202204
This will be ignored if py_version is set to 'py3'.
203205
distributions (dict): A dictionary with information on how to run distributed training
204-
(default: None). Currently we support distributed training with parameter servers and MPI. To enable
205-
parameter server use the following setup:
206+
(default: None). Currently we support distributed training with parameter servers and MPI.
207+
To enable parameter server use the following setup:
208+
209+
.. code:: python
210+
211+
{
206212
'parameter_server':
207213
{
208214
'enabled': True
209215
}
210216
}
217+
211218
To enable MPI:
219+
220+
.. code:: python
221+
212222
{
213223
'mpi':
214224
{
215225
'enabled': True
216226
}
217227
}
228+
218229
**kwargs: Additional kwargs passed to the Framework constructor.
219230
"""
220231
if framework_version is None:
@@ -281,13 +292,15 @@ def fit(self, inputs=None, wait=True, logs=True, job_name=None, run_tensorboard_
281292
Args:
282293
inputs (str or dict or sagemaker.session.s3_input): Information about the training data.
283294
This can be one of three types:
284-
(str) - the S3 location where training data is saved.
285-
(dict[str, str] or dict[str, sagemaker.session.s3_input]) - If using multiple channels for
295+
296+
* (str) - the S3 location where training data is saved.
297+
* (dict[str, str] or dict[str, sagemaker.session.s3_input]) - If using multiple channels for
286298
training data, you can specify a dict mapping channel names
287299
to strings or :func:`~sagemaker.session.s3_input` objects.
288-
(sagemaker.session.s3_input) - channel configuration for S3 data sources that can provide
300+
* (sagemaker.session.s3_input) - channel configuration for S3 data sources that can provide
289301
additional information as well as the path to the training dataset.
290302
See :func:`sagemaker.session.s3_input` for full details.
303+
291304
wait (bool): Whether the call should wait until the job completes (default: True).
292305
logs (bool): Whether to show the logs produced by the job.
293306
Only meaningful when wait is True (default: True).

src/sagemaker/tensorflow/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222

2323
class TensorFlowPredictor(RealTimePredictor):
24-
"""A ``RealTimePredictor`` for inference against TensorFlow ``Endpoint``s.
24+
"""A ``RealTimePredictor`` for inference against TensorFlow endpoint.
2525
26-
This is able to serialize Python lists, dictionaries, and numpy arrays to multidimensional tensors for MXNet
26+
This is able to serialize Python lists, dictionaries, and numpy arrays to multidimensional tensors for
2727
inference"""
2828
def __init__(self, endpoint_name, sagemaker_session=None):
2929
"""Initialize an ``TensorFlowPredictor``.

src/sagemaker/workflow/airflow.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ def model_config_from_estimator(instance_type, estimator, task_id, task_type, ro
447447
448448
Returns:
449449
dict: Model config that can be directly used by SageMakerModelOperator in Airflow. It can also be part
450-
of the config used by SageMakerEndpointOperator.
451-
SageMakerTransformOperator in Airflow.
450+
of the config used by SageMakerEndpointOperator in Airflow.
452451
"""
453452
update_estimator_from_task(estimator, task_id, task_type)
454453
if isinstance(estimator, sagemaker.estimator.Estimator):

0 commit comments

Comments
 (0)