Skip to content

Commit 6cb845c

Browse files
committed
doc: improvements on the docstring of ModelStep
1 parent 630f2c6 commit 6cb845c

File tree

4 files changed

+27
-29
lines changed

4 files changed

+27
-29
lines changed

src/sagemaker/model.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ def register(
341341
"MACHINE_LEARNING" (default: None).
342342
343343
Returns:
344-
A `sagemaker.model.ModelPackage` instance.
344+
A `sagemaker.model.ModelPackage` instance or pipeline step arguments
345+
in case the Model instance is built with
346+
:class:`~sagemaker.workflow.pipeline_context.PipelineSession`
345347
"""
346348
if self.model_data is None:
347349
raise ValueError("SageMaker Model Package cannot be created without model data.")
@@ -399,15 +401,22 @@ def create(
399401
attach to an endpoint for model loading and inference, for
400402
example, 'ml.eia1.medium'. If not specified, no Elastic
401403
Inference accelerator will be attached to the endpoint (default: None).
402-
serverless_inference_config (sagemaker.serverless.ServerlessInferenceConfig):
404+
serverless_inference_config (ServerlessInferenceConfig):
403405
Specifies configuration related to serverless endpoint. Instance type is
404406
not provided in serverless inference. So this is used to find image URIs
405407
(default: None).
406408
tags (List[Dict[str, str]]): The list of tags to add to
407-
the model (default: None). Example: >>> tags = [{'Key': 'tagname', 'Value':
408-
'tagvalue'}] For more information about tags, see
409-
https://boto3.amazonaws.com/v1/documentation
410-
/api/latest/reference/services/sagemaker.html#SageMaker.Client.add_tags
409+
the model (default: None). Example::
410+
411+
tags = [{'Key': 'tagname', 'Value':'tagvalue'}]
412+
413+
For more information about tags, see
414+
`boto3 documentation <https://boto3.amazonaws.com/v1/documentation/\
415+
api/latest/reference/services/sagemaker.html#SageMaker.Client.add_tags>`_
416+
417+
Returns:
418+
None or pipeline step arguments in case the Model instance is built with
419+
:class:`~sagemaker.workflow.pipeline_context.PipelineSession`
411420
"""
412421
# TODO: we should replace _create_sagemaker_model() with create()
413422
self._create_sagemaker_model(

src/sagemaker/workflow/README.rst

-13
This file was deleted.

src/sagemaker/workflow/model_step.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ def __init__(
5050
Args:
5151
name (str): The name of the `ModelStep`. A name is required and must be
5252
unique within a pipeline.
53-
step_args (_ModelStepArguments): The arguments for the `ModelStep` definition.
54-
depends_on (List[Union[str, Step, StepCollection]]): A list of `Step`/`StepCollection`
55-
names or `Step` instances or `StepCollection` instances that the first step,
56-
in this `ModelStep` collection, depends on.
53+
step_args (_ModelStepArguments): The arguments for the `ModelStep` definition,
54+
generated by invoking the :func:`~sagemaker.model.Model.register` or
55+
:func:`~sagemaker.model.Model.create`
56+
under the :class:`~sagemaker.workflow.pipeline_context.PipelineSession`. Example::
57+
58+
model = Model(sagemaker_session=PipelineSession())
59+
model_step = ModelStep(step_args=model.register())
60+
61+
depends_on (List[Union[str, Step, StepCollection]]):
62+
A list of `Step` or `StepCollection`
63+
names or `Step` instances or `StepCollection` instances that it depends on.
5764
If a listed `Step` name does not exist, an error is returned (default: None).
5865
retry_policies (List[RetryPolicy] or Dict[str, List[RetryPolicy]]): The list of retry
5966
policies for the `ModelStep` (default: None).

src/sagemaker/workflow/step_collections.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import attr
2020

21-
from sagemaker.deprecations import deprecated_class
2221
from sagemaker.estimator import EstimatorBase
2322
from sagemaker.model import Model
2423
from sagemaker import PipelineModel
@@ -256,18 +255,14 @@ def __init__(
256255
warnings.warn(
257256
(
258257
"We are deprecating the use of RegisterModel. "
259-
"Instead, please use the ModelStep, which simply takes in the step arguments "
260-
"generated by model.register(). For more, see: "
258+
"Please use the ModelStep instead. For more, see: "
261259
"https://sagemaker.readthedocs.io/en/stable/"
262260
"amazon_sagemaker_model_building_pipeline.html#model-step"
263261
),
264262
DeprecationWarning,
265263
)
266264

267265

268-
RegisterModel = deprecated_class(RegisterModel, "RegisterModel")
269-
270-
271266
class EstimatorTransformer(StepCollection):
272267
"""Creates a Transformer step collection for workflow."""
273268

0 commit comments

Comments
 (0)