Skip to content

Commit 9f400bd

Browse files
qidewenwhenDewen Qi
and
Dewen Qi
authored
change: Disable type hints in doc signature and add PipelineVariable annotations in docstring (#3292)
Co-authored-by: Dewen Qi <[email protected]>
1 parent ace07d7 commit 9f400bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+770
-670
lines changed

doc/conf.py

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@
9696
# Example configuration for intersphinx: refer to the Python standard library.
9797
intersphinx_mapping = {"http://docs.python.org/": None}
9898

99+
# -- Options for autodoc ----------------------------------------------------
100+
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration
101+
102+
# Automatically extract typehints when specified and place them in
103+
# descriptions of the relevant function/method.
104+
autodoc_typehints = "description"
105+
99106
# autosummary
100107
autosummary_generate = True
101108

doc/workflows/pipelines/sagemaker.workflow.pipelines.rst

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Entities
4646

4747
.. autoclass:: sagemaker.workflow.entities.Expression
4848

49+
.. autoclass:: sagemaker.workflow.entities.PipelineVariable
50+
4951
Execution Variables
5052
-------------------
5153

src/sagemaker/amazon/amazon_estimator.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,16 @@ def __init__(
316316
"""A collection of Amazon :class:~`Record` objects serialized and stored in S3.
317317
318318
Args:
319-
s3_data (str): The S3 location of the training data
319+
s3_data (str or PipelineVariable): The S3 location of the training data
320320
num_records (int): The number of records in the set.
321321
feature_dim (int): The dimensionality of "values" arrays in the
322322
Record features, and label (if each Record is labeled).
323-
s3_data_type (str): Valid values: 'S3Prefix', 'ManifestFile'. If
324-
'S3Prefix', ``s3_data`` defines a prefix of s3 objects to train
323+
s3_data_type (str or PipelineVariable): Valid values: 'S3Prefix', 'ManifestFile'.
324+
If 'S3Prefix', ``s3_data`` defines a prefix of s3 objects to train
325325
on. All objects with s3 keys beginning with ``s3_data`` will be
326326
used to train. If 'ManifestFile', then ``s3_data`` defines a
327327
single s3 manifest file, listing each s3 object to train on.
328-
channel (str): The SageMaker Training Job channel this RecordSet
328+
channel (str or PipelineVariable): The SageMaker Training Job channel this RecordSet
329329
should be bound to
330330
"""
331331
self.s3_data = s3_data

src/sagemaker/amazon/factorization_machines.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def __init__(
333333
"""Initialization for FactorizationMachinesModel class.
334334
335335
Args:
336-
model_data (str): The S3 location of a SageMaker model data
336+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
337337
``.tar.gz`` file.
338338
role (str): An AWS IAM role (either name or full ARN). The Amazon
339339
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/ipinsights.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def __init__(
236236
"""Creates object to get insights on S3 model data.
237237
238238
Args:
239-
model_data (str): The S3 location of a SageMaker model data
239+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
240240
``.tar.gz`` file.
241241
role (str): An AWS IAM role (either name or full ARN). The Amazon
242242
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/kmeans.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def __init__(
260260
"""Initialization for KMeansModel class.
261261
262262
Args:
263-
model_data (str): The S3 location of a SageMaker model data
263+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
264264
``.tar.gz`` file.
265265
role (str): An AWS IAM role (either name or full ARN). The Amazon
266266
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/knn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def __init__(
252252
"""Function to initialize KNNModel.
253253
254254
Args:
255-
model_data (str): The S3 location of a SageMaker model data
255+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
256256
``.tar.gz`` file.
257257
role (str): An AWS IAM role (either name or full ARN). The Amazon
258258
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/lda.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def __init__(
234234
"""Initialization for LDAModel class.
235235
236236
Args:
237-
model_data (str): The S3 location of a SageMaker model data
237+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
238238
``.tar.gz`` file.
239239
role (str): An AWS IAM role (either name or full ARN). The Amazon
240240
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/linear_learner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def __init__(
495495
"""Initialization for LinearLearnerModel.
496496
497497
Args:
498-
model_data (str): The S3 location of a SageMaker model data
498+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
499499
``.tar.gz`` file.
500500
role (str): An AWS IAM role (either name or full ARN). The Amazon
501501
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/ntm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def __init__(
263263
"""Initialization for NTMModel class.
264264
265265
Args:
266-
model_data (str): The S3 location of a SageMaker model data
266+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
267267
``.tar.gz`` file.
268268
role (str): An AWS IAM role (either name or full ARN). The Amazon
269269
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/object2vec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def __init__(
358358
"""Initialization for Object2VecModel class.
359359
360360
Args:
361-
model_data (str): The S3 location of a SageMaker model data
361+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
362362
``.tar.gz`` file.
363363
role (str): An AWS IAM role (either name or full ARN). The Amazon
364364
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/pca.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def __init__(
251251
"""Initialization for PCAModel.
252252
253253
Args:
254-
model_data (str): The S3 location of a SageMaker model data
254+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
255255
``.tar.gz`` file.
256256
role (str): An AWS IAM role (either name or full ARN). The Amazon
257257
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/amazon/randomcutforest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def __init__(
223223
"""Initialization for RandomCutForestModel class.
224224
225225
Args:
226-
model_data (str): The S3 location of a SageMaker model data
226+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
227227
``.tar.gz`` file.
228228
role (str): An AWS IAM role (either name or full ARN). The Amazon
229229
SageMaker training jobs and APIs that create Amazon SageMaker

src/sagemaker/chainer/estimator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(
7474
home-page: https://github.com/aws/sagemaker-python-sdk
7575
7676
Args:
77-
entry_point (str): Path (absolute or relative) to the Python source
77+
entry_point (str or PipelineVariable): Path (absolute or relative) to the Python source
7878
file which should be executed as the entry point to training.
7979
If ``source_dir`` is specified, then ``entry_point``
8080
must point to a file located at the root of ``source_dir``.
@@ -92,7 +92,7 @@ def __init__(
9292
command used to run the entry point. For example, '-X
9393
NCCL_DEBUG=WARN' will pass that option string to the mpirun
9494
command.
95-
source_dir (str): Path (absolute or relative) to a directory with
95+
source_dir (str or PipelineVariable): Path (absolute or relative) to a directory with
9696
any other training source code dependencies aside from the entry
9797
point file (default: None). Structure within this directory are
9898
preserved when training on Amazon SageMaker.

src/sagemaker/chainer/model.py

+40-34
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def __init__(
9494
"""Initialize an ChainerModel.
9595
9696
Args:
97-
model_data (str): The S3 location of a SageMaker model data
97+
model_data (str or PipelineVariable): The S3 location of a SageMaker model data
9898
``.tar.gz`` file.
9999
role (str): An AWS IAM role (either name or full ARN). The Amazon
100100
SageMaker training jobs and APIs that create Amazon SageMaker
@@ -105,8 +105,8 @@ def __init__(
105105
file which should be executed as the entry point to model
106106
hosting. If ``source_dir`` is specified, then ``entry_point``
107107
must point to a file located at the root of ``source_dir``.
108-
image_uri (str): A Docker image URI (default: None). If not specified,
109-
a default image for Chainer will be used.
108+
image_uri (str or PipelineVariable): A Docker image URI (default: None).
109+
If not specified, a default image for Chainer will be used.
110110
If ``framework_version`` or ``py_version``
111111
are ``None``, then ``image_uri`` is required. If ``image_uri`` is also ``None``,
112112
then a ``ValueError`` will be raised.
@@ -120,7 +120,7 @@ def __init__(
120120
to call to create a predictor with an endpoint name and
121121
SageMaker ``Session``. If specified, ``deploy()`` returns the
122122
result of invoking this function on the created endpoint name.
123-
model_server_workers (int): Optional. The number of worker processes
123+
model_server_workers (int or PipelineVariable): Optional. The number of worker processes
124124
used by the inference server. If None, server will use one
125125
worker per vCPU.
126126
**kwargs: Keyword arguments passed to the
@@ -173,43 +173,49 @@ def register(
173173
"""Creates a model package for creating SageMaker models or listing on Marketplace.
174174
175175
Args:
176-
content_types (list): The supported MIME types for the input data.
177-
response_types (list): The supported MIME types for the output data.
178-
inference_instances (list): A list of the instance types that are used to
179-
generate inferences in real-time.
180-
transform_instances (list): A list of the instance types on which a transformation
181-
job can be run or on which an endpoint can be deployed.
182-
model_package_name (str): Model Package name, exclusive to `model_package_group_name`,
183-
using `model_package_name` makes the Model Package un-versioned (default: None).
184-
model_package_group_name (str): Model Package Group name, exclusive to
185-
`model_package_name`, using `model_package_group_name` makes the Model Package
186-
versioned (default: None).
187-
image_uri (str): Inference image uri for the container. Model class' self.image will
188-
be used if it is None (default: None).
176+
content_types (list[str] or list[PipelineVariable]): The supported MIME types
177+
for the input data.
178+
response_types (list[str] or list[PipelineVariable]): The supported MIME types
179+
for the output data.
180+
inference_instances (list[str] or list[PipelineVariable]): A list of the instance
181+
types that are used to generate inferences in real-time.
182+
transform_instances (list[str] or list[PipelineVariable]): A list of the instance
183+
types on which a transformation job can be run or on which an endpoint
184+
can be deployed.
185+
model_package_name (str or PipelineVariable): Model Package name, exclusive to
186+
`model_package_group_name`, using `model_package_name` makes the Model Package
187+
un-versioned (default: None).
188+
model_package_group_name (str or PipelineVariable): Model Package Group name,
189+
exclusive to `model_package_name`, using `model_package_group_name` makes the
190+
Model Package versioned (default: None).
191+
image_uri (str or PipelineVariable): Inference image uri for the container. Model class'
192+
self.image will be used if it is None (default: None).
189193
model_metrics (ModelMetrics): ModelMetrics object (default: None).
190194
metadata_properties (MetadataProperties): MetadataProperties (default: None).
191195
marketplace_cert (bool): A boolean value indicating if the Model Package is certified
192196
for AWS Marketplace (default: False).
193-
approval_status (str): Model Approval Status, values can be "Approved", "Rejected",
194-
or "PendingManualApproval" (default: "PendingManualApproval").
197+
approval_status (str or PipelineVariable): Model Approval Status, values can be
198+
"Approved", "Rejected", or "PendingManualApproval"
199+
(default: "PendingManualApproval").
195200
description (str): Model Package description (default: None).
196201
drift_check_baselines (DriftCheckBaselines): DriftCheckBaselines object (default: None).
197-
customer_metadata_properties (dict[str, str]): A dictionary of key-value paired
198-
metadata properties (default: None).
199-
domain (str): Domain values can be "COMPUTER_VISION", "NATURAL_LANGUAGE_PROCESSING",
200-
"MACHINE_LEARNING" (default: None).
201-
sample_payload_url (str): The S3 path where the sample payload is stored
202+
customer_metadata_properties (dict[str, str] or dict[str, PipelineVariable]):
203+
A dictionary of key-value paired metadata properties (default: None).
204+
domain (str or PipelineVariable): Domain values can be "COMPUTER_VISION",
205+
"NATURAL_LANGUAGE_PROCESSING", "MACHINE_LEARNING" (default: None).
206+
sample_payload_url (str or PipelineVariable): The S3 path where the sample payload
207+
is stored (default: None).
208+
task (str or PipelineVariable): Task values which are supported by Inference Recommender
209+
are "FILL_MASK", "IMAGE_CLASSIFICATION", "OBJECT_DETECTION", "TEXT_GENERATION",
210+
"IMAGE_SEGMENTATION", "CLASSIFICATION", "REGRESSION", "OTHER" (default: None).
211+
framework (str or PipelineVariable): Machine learning framework of the model package
212+
container image (default: None).
213+
framework_version (str or PipelineVariable): Framework version of the Model Package
214+
Container Image (default: None).
215+
nearest_model_name (str or PipelineVariable): Name of a pre-trained machine learning
216+
benchmarked by Amazon SageMaker Inference Recommender (default: None).
217+
data_input_configuration (str or PipelineVariable): Input object for the model
202218
(default: None).
203-
task (str): Task values which are supported by Inference Recommender are "FILL_MASK",
204-
"IMAGE_CLASSIFICATION", "OBJECT_DETECTION", "TEXT_GENERATION", "IMAGE_SEGMENTATION",
205-
"CLASSIFICATION", "REGRESSION", "OTHER" (default: None).
206-
framework (str): Machine learning framework of the model package container image
207-
(default: None).
208-
framework_version (str): Framework version of the Model Package Container Image
209-
(default: None).
210-
nearest_model_name (str): Name of a pre-trained machine learning benchmarked by
211-
Amazon SageMaker Inference Recommender (default: None).
212-
data_input_configuration (str): Input object for the model (default: None).
213219
214220
Returns:
215221
str: A string of SageMaker Model Package ARN.

0 commit comments

Comments
 (0)