Skip to content

Commit 363edc8

Browse files
bhaozknikure
authored andcommitted
doc: update docstring for Generation two endpoint and validation message (#1402)
1 parent 1409f54 commit 363edc8

File tree

22 files changed

+84
-86
lines changed

22 files changed

+84
-86
lines changed

src/sagemaker/amazon/kmeans.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def __init__(
238238
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
239239
Default parses responses from x-recordio-protobuf format.
240240
component_name (str): Optional. Name of the Amazon SageMaker inference
241-
component corresponding the predictor.
241+
component corresponding to the predictor.
242242
"""
243243
super(KMeansPredictor, self).__init__(
244244
endpoint_name,

src/sagemaker/amazon/knn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def __init__(
229229
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
230230
Default parses responses from x-recordio-protobuf format.
231231
component_name (str): Optional. Name of the Amazon SageMaker inference
232-
component corresponding the predictor.
232+
component corresponding to the predictor.
233233
"""
234234
super(KNNPredictor, self).__init__(
235235
endpoint_name,

src/sagemaker/amazon/lda.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def __init__(
213213
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
214214
Default parses responses from x-recordio-protobuf format.
215215
component_name (str): Optional. Name of the Amazon SageMaker inference
216-
component corresponding the predictor.
216+
component corresponding to the predictor.
217217
"""
218218
super(LDAPredictor, self).__init__(
219219
endpoint_name,

src/sagemaker/amazon/linear_learner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def __init__(
482482
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
483483
Default parses responses from x-recordio-protobuf format.
484484
component_name (str): Optional. Name of the Amazon SageMaker inference
485-
component corresponding the predictor.
485+
component corresponding to the predictor.
486486
"""
487487
super(LinearLearnerPredictor, self).__init__(
488488
endpoint_name,

src/sagemaker/amazon/ntm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def __init__(
246246
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
247247
Default parses responses from x-recordio-protobuf format.
248248
component_name (str): Optional. Name of the Amazon SageMaker inference
249-
component corresponding the predictor.
249+
component corresponding to the predictor.
250250
"""
251251
super(NTMPredictor, self).__init__(
252252
endpoint_name,

src/sagemaker/amazon/pca.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def __init__(
226226
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
227227
Default parses responses from x-recordio-protobuf format.
228228
component_name (str): Optional. Name of the Amazon SageMaker inference
229-
component corresponding the predictor.
229+
component corresponding to the predictor.
230230
"""
231231
super(PCAPredictor, self).__init__(
232232
endpoint_name,

src/sagemaker/amazon/randomcutforest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def __init__(
199199
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
200200
Default parses responses from x-recordio-protobuf format.
201201
component_name (str): Optional. Name of the Amazon SageMaker inference
202-
component corresponding the predictor.
202+
component corresponding to the predictor.
203203
"""
204204
super(RandomCutForestPredictor, self).__init__(
205205
endpoint_name,

src/sagemaker/base_predictor.py

+30-28
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ def delete_endpoint(self, delete_endpoint_config=True):
442442
def delete_predictor(self, wait: bool = False) -> None:
443443
"""Delete the Amazon SageMaker inference component or endpoint backing this predictor.
444444
445-
Delete the corresponding inference component if the endpoint is Generation2
445+
Delete the corresponding inference component if the endpoint is a Generation2
446446
endpoint.
447-
Otherwise delete the endpoint where this predictor is on.
447+
Otherwise delete the endpoint where this predictor is hosted.
448448
"""
449449

450450
if self.component_name:
@@ -462,13 +462,15 @@ def update_predictor(
462462
container_startup_health_check_timeout: Optional[int] = None,
463463
resources: Optional[ResourceRequirements] = None,
464464
):
465-
"""Updates the predictor to deploy a new Model specification and apply new configurations.
465+
"""Updates the predictor.
466466
467-
This is done by updating the SageMaker InferenceComponent.
467+
You can deploy a new Model specification or apply new configurations. The SDK
468+
applies your updates by updating the inference component that's associated with
469+
the model.
468470
469471
Args:
470-
model_name (Optional[str]): The model name to use to update
471-
for the predictor. (Default: None).
472+
model_name (Optional[str]): The model name to use to update the
473+
predictor. (Default: None).
472474
image_uri (Optional[str]): A Docker image URI. (Default: None).
473475
model_data (Optional[Union[str, dict]]): Location
474476
of SageMaker model data. (Default: None).
@@ -488,8 +490,8 @@ def update_predictor(
488490
"""
489491
if self.component_name is None:
490492
raise ValueError(
491-
"No existing Inference Component; "
492-
"Please ensure you deployed Inference Component first."
493+
"No inference component exists for the specified model. "
494+
"Ensure that you deployed the inference component, and try again."
493495
)
494496
# [TODO]: Move to a module
495497
request = {
@@ -561,38 +563,38 @@ def list_related_models(
561563
the predictor.
562564
563565
Args:
564-
variant_name_equals (str): Optional. A string that matches the variant
565-
name deployed those Inference Components. (Default: None).
566-
name_contains (str): Optional. A string that partially matches one or
567-
more Inference Components' names. Filters InferenceComponents by name.
566+
variant_name_equals (str): Optional. A string that matches the name of the
567+
variant that was assigned to the inference component. (Default: None).
568+
name_contains (str): Optional. A string that partially matches the names of one or
569+
more inference components. Filters inference components by name.
568570
(Default: None).
569571
creation_time_after (datetime.datetime): Optional. Use this parameter to
570-
search for InferenceComponents created after a specific date and time.
572+
search for inference components created after a specific date and time.
571573
(Default: None).
572574
creation_time_before (datetime.datetime): Optional. Use this parameter to
573-
search for InferenceComponents created before a specific date and time.
575+
search for inference components created before a specific date and time.
574576
(Default: None).
575577
last_modified_time_after (datetime.datetime): Optional. Use this parameter to
576-
search for InferenceComponents last modified after a specific date and time.
577-
(Default: None).
578+
search for inference components that were last modified after a specific date
579+
and time. (Default: None).
578580
last_modified_time_before (datetime.datetime): Optional. Use this parameter to
579-
search for InferenceComponents last modified before a specific date and time.
580-
(Default: None).
581-
status_equals (str): Optional. The Inference Component status. Filters
582-
InferenceComponents by status. (Default: None).
583-
sort_order (str): Optional. The order in which InferenceComponents are listed.
581+
search for inference components that were last modified before a specific date
582+
and time. (Default: None).
583+
status_equals (str): Optional. The inference component status. Filters
584+
inference components by status. (Default: None).
585+
sort_order (str): Optional. The order in which inference components are listed.
584586
(Default: None).
585-
sort_by (str): Optional. The value on which the InferenceComponent list is
586-
sorted. (Default: None).
587+
sort_order (str): Optional. The order in which inference components are listed in
588+
the response. (Default: None).
587589
max_results (int): Optional. The maximum number of results returned by
588-
ListInferenceComponents. (Default: None).
589-
next_token (str): Optional. A token to resume pagination of ListInferenceComponents
590+
list_related_models. (Default: None).
591+
next_token (str): Optional. A token to resume pagination of list_related_models
590592
results. (Default: None).
591593
592594
Returns:
593-
Tuple[List[Dict[str, Any]], Optional[str]]: A list of Amazon SageMaker Inference
594-
Component objects associated to the Endpoint. If NextToken is returned,
595-
there are more results available. The value of nextToken is a unique
595+
Tuple[List[Dict[str, Any]], Optional[str]]: A list of Amazon SageMaker inference
596+
component objects associated with the endpoint. If a next token is returned,
597+
there are more results available. The value of the next token is a unique
596598
pagination token.
597599
"""
598600

src/sagemaker/chainer/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(
6767
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
6868
Default parses the response from .npy format to numpy array.
6969
component_name (str): Optional. Name of the Amazon SageMaker inference
70-
component corresponding the predictor.
70+
component corresponding to the predictor.
7171
"""
7272
super(ChainerPredictor, self).__init__(
7373
endpoint_name,

src/sagemaker/compute_resource_requirements/resource_requirements.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""Defines the ResourceRequirements class that configures a compute resources for Model."""
13+
"""Defines the ResourceRequirements class that configures the compute resources for the Model."""
1414

1515
from __future__ import absolute_import
1616

@@ -23,14 +23,14 @@
2323

2424

2525
class ResourceRequirements(object):
26-
"""The class to ResourceRequirements class that configures a compute resources for Model"""
26+
"""Configures the compute resources for a Model."""
2727

2828
def __init__(
2929
self,
3030
requests: Optional[Dict[str, int]] = None,
3131
limits: Optional[Dict[str, int]] = None,
3232
):
33-
"""It initializes a ``ResourceRequirements`` for Amazon SageMaker Inference Component.
33+
"""Initializes a ResourceRequirements object for an Amazon SageMaker inference component.
3434
3535
Args:
3636
requests (dict): Basic resource to be requested, including num_cpus, memory (in MB),
@@ -77,10 +77,7 @@ def __eq__(self, other) -> bool:
7777
return self.requests == other.requests and self.limits == other.limits
7878

7979
def get_compute_resource_requirements(self) -> dict:
80-
"""Return a dict of resource requirements
81-
82-
It is structured as ComputeResourceRequirements in SageMaker InferenceComponent APIs.
83-
"""
80+
"""Returns a dict of resource requirements."""
8481
resource_requirements = {
8582
"MinMemoryRequiredInMb": self.min_memory,
8683
}

src/sagemaker/huggingface/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
6767
Default parses the response from .npy format to numpy array.
6868
component_name (str): Optional. Name of the Amazon SageMaker inference
69-
component corresponding the predictor.
69+
component corresponding to the predictor.
7070
"""
7171
super(HuggingFacePredictor, self).__init__(
7272
endpoint_name,

src/sagemaker/jumpstart/artifacts/resource_requirements.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _retrieve_default_resources(
6161
specified, one is created using the default AWS configuration
6262
chain. (Default: sagemaker.jumpstart.constants.DEFAULT_JUMPSTART_SAGEMAKER_SESSION).
6363
Returns:
64-
str: the default resource requirements to use for the model or None.
64+
str: The default resource requirements to use for the model or None.
6565
6666
Raises:
6767
ValueError: If the model is not available in the

src/sagemaker/jumpstart/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
NO_AVAILABLE_RESOURCE_REQUIREMENT_RECOMMENDATION_ERROR_MSG = (
2525
"No available compute resource requirement recommendation for model ID '{model_id}'. "
26-
"Please provide the resource requirements in the deploy method."
26+
"Provide the resource requirements in the deploy method."
2727
)
2828

2929
INVALID_MODEL_ID_ERROR_MSG = (

src/sagemaker/jumpstart/factory/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def _add_deploy_extra_kwargs(kwargs: JumpStartModelInitKwargs) -> Dict[str, Any]
469469

470470

471471
def _add_resources_to_kwargs(kwargs: JumpStartModelInitKwargs) -> JumpStartModelInitKwargs:
472-
"""Sets resource requirements based on default or override, returns full kwargs."""
472+
"""Sets the resource requirements based on the default or an override. Returns full kwargs."""
473473

474474
kwargs.resources = kwargs.resources or resource_requirements.retrieve_default(
475475
region=kwargs.region,

src/sagemaker/jumpstart/model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ def deploy(
551551
this feature. (Default: None).
552552
managed_instance_scaling (Optional[Dict]): Managed intance scaling options,
553553
if configured Amazon SageMaker will manage the instance number behind the
554-
Endpoint
555-
endpoint_type (EndpointType): The type of an endpoint used to deploy models.
554+
endpoint.
555+
endpoint_type (EndpointType): The type of endpoint used to deploy models.
556556
(Default: EndpointType.GEN1).
557557
"""
558558

src/sagemaker/mxnet/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(
6868
deserializer (callable): Optional. Default parses the response using
6969
``json.load(...)``.
7070
component_name (str): Optional. Name of the Amazon SageMaker inference
71-
component corresponding the predictor.
71+
component corresponding to the predictor.
7272
"""
7373
super(MXNetPredictor, self).__init__(
7474
endpoint_name,

src/sagemaker/pytorch/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(
6969
deserializer (sagemaker.deserializers.BaseDeserializer): Optional.
7070
Default parses the response from .npy format to numpy array.
7171
component_name (str): Optional. Name of the Amazon SageMaker inference
72-
component corresponding the predictor.
72+
component corresponding to the predictor.
7373
"""
7474
super(PyTorchPredictor, self).__init__(
7575
endpoint_name,

0 commit comments

Comments
 (0)