Skip to content

Commit fdcd90f

Browse files
committed
doc: improvements on the docstring of ModelStep
1 parent c53bbbc commit fdcd90f

File tree

4 files changed

+25
-30
lines changed

4 files changed

+25
-30
lines changed

src/sagemaker/model.py

+14-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,21 @@ 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/api/latest/reference/services/sagemaker.html#SageMaker.Client.add_tags>`_
415+
416+
Returns:
417+
None or pipeline step arguments in case the Model instance is built with
418+
:class:`~sagemaker.workflow.pipeline_context.PipelineSession`
411419
"""
412420
# TODO: we should replace _create_sagemaker_model() with create()
413421
self._create_sagemaker_model(

src/sagemaker/workflow/README.rst

-13
This file was deleted.

src/sagemaker/workflow/model_step.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,16 @@ 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(session=PipelineSession())
59+
model_step = ModelStep(step_args=model.register())
60+
61+
depends_on (List[Union[str, Step, StepCollection]]): A list of `Step` or `StepCollection`
62+
names or `Step` instances or `StepCollection` instances that it depends on.
5763
If a listed `Step` name does not exist, an error is returned (default: None).
5864
retry_policies (List[RetryPolicy] or Dict[str, List[RetryPolicy]]): The list of retry
5965
policies for the `ModelStep` (default: None).

src/sagemaker/workflow/step_collections.py

+1-7
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,17 +255,12 @@ def __init__(
256255
# TODO: add public document link here once ready
257256
warnings.warn(
258257
(
259-
"We are deprecating the use of RegisterModel. "
260-
"Instead, please use the ModelStep, which simply takes in the step arguments "
261-
"generated by model.register()."
258+
"We are deprecating the use of RegisterModel. Use ModelStep instead."
262259
),
263260
DeprecationWarning,
264261
)
265262

266263

267-
RegisterModel = deprecated_class(RegisterModel, "RegisterModel")
268-
269-
270264
class EstimatorTransformer(StepCollection):
271265
"""Creates a Transformer step collection for workflow."""
272266

0 commit comments

Comments
 (0)