Skip to content

Commit 1f08fc6

Browse files
committed
chore: resolve git comments, fix model id capitalization
1 parent 6dcf448 commit 1f08fc6

File tree

12 files changed

+35
-35
lines changed

12 files changed

+35
-35
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
### Features
6767

6868
* override jumpstart content bucket
69-
* jumpstart model id suggestions
69+
* jumpstart model ID suggestions
7070
* adding customer metadata support to registermodel step
7171

7272
### Bug Fixes and Other Changes

doc/doc_utils/jumpstart_doc_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def create_jumpstart_model_table():
5656
file_content.append("==================================\n")
5757
file_content.append(
5858
"""
59-
JumpStart for the SageMaker Python SDK uses model ids and model versions to access the necessary
59+
JumpStart for the SageMaker Python SDK uses model IDs and model versions to access the necessary
6060
utilities. This table serves to provide the core material plus some extra information that can be useful
61-
in selecting the correct model id and corresponding parameters.\n
61+
in selecting the correct model ID and corresponding parameters.\n
6262
"""
6363
)
6464
file_content.append(

doc/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ the ``model_id`` and ``model_version`` needed to retrieve the URI.
636636
model. To use the latest version, enter ``"*"``. This is a
637637
required parameter.
638638
639-
To retrieve a model, first select a ``model id`` and ``version`` from
639+
To retrieve a model, first select a ``model ID`` and ``version`` from
640640
the :doc:`available models <./doc_utils/jumpstart>`.
641641

642642
.. code:: python

src/sagemaker/jumpstart/accessors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def get_model_header(region: str, model_id: str, version: str) -> JumpStartModel
8484
8585
Args:
8686
region (str): region for which to retrieve header.
87-
model_id (str): model id to retrieve.
88-
version (str): semantic version to retrieve for the model id.
87+
model_id (str): model ID to retrieve.
88+
version (str): semantic version to retrieve for the model ID.
8989
"""
9090
cache_kwargs = JumpStartModelsAccessor._validate_and_mutate_region_cache_kwargs(
9191
JumpStartModelsAccessor._cache_kwargs, region
@@ -101,8 +101,8 @@ def get_model_specs(region: str, model_id: str, version: str) -> JumpStartModelS
101101
102102
Args:
103103
region (str): region for which to retrieve header.
104-
model_id (str): model id to retrieve.
105-
version (str): semantic version to retrieve for the model id.
104+
model_id (str): model ID to retrieve.
105+
version (str): semantic version to retrieve for the model ID.
106106
"""
107107
cache_kwargs = JumpStartModelsAccessor._validate_and_mutate_region_cache_kwargs(
108108
JumpStartModelsAccessor._cache_kwargs, region

src/sagemaker/jumpstart/cache.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ def _get_manifest_key_from_model_id_semantic_version(
146146
key: JumpStartVersionedModelId,
147147
value: Optional[JumpStartVersionedModelId], # pylint: disable=W0613
148148
) -> JumpStartVersionedModelId:
149-
"""Return model id and version in manifest that matches semantic version/id.
149+
"""Return model ID and version in manifest that matches semantic version/id.
150150
151151
Uses ``packaging.version`` to perform version comparison. The highest model version
152152
matching the semantic version is used, which is compatible with the SageMaker
153153
version.
154154
155155
Args:
156-
key (JumpStartVersionedModelId): Key for which to fetch versioned model id.
156+
key (JumpStartVersionedModelId): Key for which to fetch versioned model ID.
157157
value (Optional[JumpStartVersionedModelId]): Unused variable for current value of
158-
old cached model id/version.
158+
old cached model ID/version.
159159
160160
Raises:
161161
KeyError: If the semantic version is not found in the manifest, or is found but
@@ -287,10 +287,10 @@ def get_manifest(self) -> List[JumpStartModelHeader]:
287287
return manifest
288288

289289
def get_header(self, model_id: str, semantic_version_str: str) -> JumpStartModelHeader:
290-
"""Return header for a given JumpStart model id and semantic version.
290+
"""Return header for a given JumpStart model ID and semantic version.
291291
292292
Args:
293-
model_id (str): model id for which to get a header.
293+
model_id (str): model ID for which to get a header.
294294
semantic_version_str (str): The semantic version for which to get a
295295
header.
296296
"""
@@ -331,7 +331,7 @@ def _get_header_impl(
331331
Allows a single retry if the cache is old.
332332
333333
Args:
334-
model_id (str): model id for which to get a header.
334+
model_id (str): model ID for which to get a header.
335335
semantic_version_str (str): The semantic version for which to get a
336336
header.
337337
attempt (int): attempt number at retrieving a header.
@@ -353,10 +353,10 @@ def _get_header_impl(
353353
return self._get_header_impl(model_id, semantic_version_str, attempt + 1)
354354

355355
def get_specs(self, model_id: str, semantic_version_str: str) -> JumpStartModelSpecs:
356-
"""Return specs for a given JumpStart model id and semantic version.
356+
"""Return specs for a given JumpStart model ID and semantic version.
357357
358358
Args:
359-
model_id (str): model id for which to get specs.
359+
model_id (str): model ID for which to get specs.
360360
semantic_version_str (str): The semantic version for which to get
361361
specs.
362362
"""
@@ -369,6 +369,6 @@ def get_specs(self, model_id: str, semantic_version_str: str) -> JumpStartModelS
369369
return specs # type: ignore
370370

371371
def clear(self) -> None:
372-
"""Clears the model id/version and s3 cache."""
372+
"""Clears the model ID/version and s3 cache."""
373373
self._s3_cache.clear()
374374
self._model_id_semantic_version_manifest_key_cache.clear()

src/sagemaker/jumpstart/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __init__(
4949
"""Instantiates VulnerableJumpStartModelError exception.
5050
5151
Args:
52-
model_id (Optional[str]): model id of vulnerable JumpStart model.
52+
model_id (Optional[str]): model ID of vulnerable JumpStart model.
5353
(Default: None).
5454
version (Optional[str]): version of vulnerable JumpStart model.
5555
(Default: None).

src/sagemaker/jumpstart/filters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ def eval(self) -> None:
9797
return
9898

9999
@property
100-
def resolved_value(self):
100+
def resolved_value(self) -> BooleanValues:
101101
"""Getter method for resolved_value."""
102102
return self._resolved_value
103103

104104
@resolved_value.setter
105-
def resolved_value(self, new_resolved_value: Any):
105+
def resolved_value(self, new_resolved_value: Any) -> None:
106106
"""Setter method for resolved_value. Resolved_value must be of type ``BooleanValues``."""
107107
if isinstance(new_resolved_value, BooleanValues):
108108
self._resolved_value = new_resolved_value
@@ -272,7 +272,7 @@ def eval(self) -> None:
272272
"""Evaluates operator.
273273
274274
Raises:
275-
RuntimeError: If the operands remain unevaluated after calling ``eval``,
275+
RuntimeError: If the operand remains unevaluated after calling ``eval``,
276276
or if the resolved value isn't a ``BooleanValues`` type.
277277
"""
278278
if not issubclass(type(self.operand), Operand):
@@ -363,7 +363,7 @@ def eval(self) -> None:
363363
"""Evaluates operator.
364364
365365
Raises:
366-
RuntimeError: If the operands remain unevaluated after calling ``eval``,
366+
RuntimeError: If the operand remains unevaluated after calling ``eval``,
367367
or if the resolved value isn't a ``BooleanValues`` type.
368368
"""
369369

src/sagemaker/jumpstart/notebook_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def _compare_model_version_tuples( # pylint: disable=too-many-return-statements
3737
"""Performs comparison of sdk specs paths, in order to sort them.
3838
3939
Args:
40-
model_version_1 (Tuple[str, str]): The first model id and version tuple to compare.
41-
model_version_2 (Tuple[str, str]): The second model id and version tuple to compare.
40+
model_version_1 (Tuple[str, str]): The first model ID and version tuple to compare.
41+
model_version_2 (Tuple[str, str]): The second model ID and version tuple to compare.
4242
"""
4343
if model_version_1 is None or model_version_2 is None:
4444
if model_version_2 is not None:
@@ -112,7 +112,7 @@ def extract_framework_task_model(model_id: str) -> Tuple[str, str, str]:
112112
model_id (str): The model ID for which to extract the framework/task/model.
113113
114114
Raises:
115-
ValueError: If the model id cannot be parsed into at least 3 components seperated by
115+
ValueError: If the model ID cannot be parsed into at least 3 components seperated by
116116
"-" character.
117117
"""
118118
_id_parts = model_id.split("-")
@@ -356,7 +356,7 @@ def _generate_jumpstart_model_versions( # pylint: disable=redefined-builtin
356356
if copied_filter.resolved_value == BooleanValues.UNEVALUATED:
357357
raise RuntimeError(
358358
"Filter expression in unevaluated state after using values from model manifest. "
359-
"Model id and version that is failing: "
359+
"Model ID and version that is failing: "
360360
f"{(model_manifest.model_id, model_manifest.version)}."
361361
)
362362
copied_filter_2 = copy.deepcopy(filter)
@@ -395,7 +395,7 @@ def _generate_jumpstart_model_versions( # pylint: disable=redefined-builtin
395395

396396
raise RuntimeError(
397397
"Filter expression in unevaluated state after using values from model specs. "
398-
"Model id and version that is failing: "
398+
"Model ID and version that is failing: "
399399
f"{(model_manifest.model_id, model_manifest.version)}."
400400
)
401401

src/sagemaker/jumpstart/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def to_json(self) -> Dict[str, Any]:
360360

361361

362362
class JumpStartVersionedModelId(JumpStartDataHolderType):
363-
"""Data class for versioned model ids."""
363+
"""Data class for versioned model IDs."""
364364

365365
__slots__ = ["model_id", "version"]
366366

@@ -372,7 +372,7 @@ def __init__(
372372
"""Instantiates JumpStartVersionedModelId object.
373373
374374
Args:
375-
model_id (str): JumpStart model id.
375+
model_id (str): JumpStart model ID.
376376
version (str): JumpStart model version.
377377
"""
378378
self.model_id = model_id
@@ -418,7 +418,7 @@ def __init__(
418418
formatted_content (Union[Dict[JumpStartVersionedModelId, JumpStartModelHeader],
419419
JumpStartModelSpecs]):
420420
Formatted content for model specs and mappings from
421-
versioned model ids to specs.
421+
versioned model IDs to specs.
422422
md5_hash (str): md5_hash for stored file content from s3.
423423
"""
424424
self.formatted_content = formatted_content

src/sagemaker/jumpstart/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def verify_model_region_and_return_specs(
327327
"""Verifies that an acceptable model_id, version, scope, and region combination is provided.
328328
329329
Args:
330-
model_id (Optional[str]): model id of the JumpStart model to verify and
330+
model_id (Optional[str]): model ID of the JumpStart model to verify and
331331
obtains specs.
332332
version (Optional[str]): version of the JumpStart model to verify and
333333
obtains specs.

tests/unit/sagemaker/jumpstart/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_jumpstart_model_specs():
149149

150150
assert specs1.to_json() == BASE_SPEC
151151

152-
BASE_SPEC["model_id"] = "diff model id"
152+
BASE_SPEC["model_id"] = "diff model ID"
153153
specs2 = JumpStartModelSpecs(BASE_SPEC)
154154
assert specs1 != specs2
155155

tests/unit/sagemaker/jumpstart/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_header_from_base_header(
5555
"sklearn" not in model_id,
5656
]
5757
):
58-
raise KeyError("Bad model id")
58+
raise KeyError("Bad model ID")
5959

6060
if region is not None and region not in JUMPSTART_REGION_NAME_SET:
6161
raise ValueError(
@@ -85,7 +85,7 @@ def get_prototype_model_spec(
8585
region: str = None, model_id: str = None, version: str = None
8686
) -> JumpStartModelSpecs:
8787
"""This function mocks cache accessor functions. For this mock,
88-
we only retrieve model specs based on the model id.
88+
we only retrieve model specs based on the model ID.
8989
"""
9090

9191
specs = JumpStartModelSpecs(PROTOTYPICAL_MODEL_SPECS_DICT[model_id])
@@ -115,7 +115,7 @@ def get_spec_from_base_spec(
115115
"sklearn" not in model_id,
116116
]
117117
):
118-
raise KeyError("Bad model id")
118+
raise KeyError("Bad model ID")
119119

120120
if region is not None and region not in JUMPSTART_REGION_NAME_SET:
121121
raise ValueError(

0 commit comments

Comments
 (0)