Skip to content

Commit d66432e

Browse files
committed
chore: resolve git comments
1 parent c9f2112 commit d66432e

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

src/sagemaker/jumpstart/cache.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -205,29 +205,29 @@ def _get_manifest_key_from_model_id_semantic_version(
205205
sm_version_to_use = sm_version_to_use_list[0]
206206

207207
error_msg = (
208-
f"Unable to find model manifest for {model_id} with version {version} "
209-
f"compatible with your SageMaker version ({sm_version}). "
208+
f"Unable to find model manifest for '{model_id}' with version '{version}' "
209+
f"compatible with your SageMaker version ('{sm_version}'). "
210210
f"Consider upgrading your SageMaker library to at least version "
211-
f"{sm_version_to_use} so you can use version "
212-
f"{model_version_to_use_incompatible_with_sagemaker} of {model_id}."
211+
f"'{sm_version_to_use}' so you can use version "
212+
f"'{model_version_to_use_incompatible_with_sagemaker}' of '{model_id}'."
213213
)
214214
raise KeyError(error_msg)
215215

216-
error_msg = f"Unable to find model manifest for {model_id} with version {version}. "
216+
error_msg = f"Unable to find model manifest for '{model_id}' with version '{version}'. "
217217

218218
other_model_id_version = self._select_version(
219219
"*", versions_incompatible_with_sagemaker
220-
)
220+
) # all versions here are incompatible with sagemaker
221221
if other_model_id_version is not None:
222222
error_msg += (
223-
f"Consider using model id {model_id} with version "
224-
f"{other_model_id_version}."
223+
f"Consider using model ID '{model_id}' with version "
224+
f"'{other_model_id_version}'."
225225
)
226226

227227
else:
228228
possible_model_ids = [header.model_id for header in manifest.values()]
229229
closest_model_id = get_close_matches(model_id, possible_model_ids, n=1, cutoff=0)[0]
230-
error_msg += f"Did you mean to use model id {closest_model_id}?"
230+
error_msg += f"Did you mean to use model ID '{closest_model_id}'?"
231231

232232
raise KeyError(error_msg)
233233

src/sagemaker/jumpstart/types.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def from_json(self, json_obj: Dict[str, str]) -> None:
135135
class JumpStartECRSpecs(JumpStartDataHolderType):
136136
"""Data class for JumpStart ECR specs."""
137137

138-
__slots__ = {
138+
__slots__ = [
139139
"framework",
140140
"framework_version",
141141
"py_version",
142142
"huggingface_transformers_version",
143-
}
143+
]
144144

145145
def __init__(self, spec: Dict[str, Any]):
146146
"""Initializes a JumpStartECRSpecs object from its json representation.
@@ -173,7 +173,7 @@ def to_json(self) -> Dict[str, Any]:
173173
class JumpStartHyperparameter(JumpStartDataHolderType):
174174
"""Data class for JumpStart hyperparameter definition in the training container."""
175175

176-
__slots__ = {
176+
__slots__ = [
177177
"name",
178178
"type",
179179
"options",
@@ -183,7 +183,7 @@ class JumpStartHyperparameter(JumpStartDataHolderType):
183183
"max",
184184
"exclusive_min",
185185
"exclusive_max",
186-
}
186+
]
187187

188188
def __init__(self, spec: Dict[str, Any]):
189189
"""Initializes a JumpStartHyperparameter object from its json representation.
@@ -234,12 +234,12 @@ def to_json(self) -> Dict[str, Any]:
234234
class JumpStartEnvironmentVariable(JumpStartDataHolderType):
235235
"""Data class for JumpStart environment variable definitions in the hosting container."""
236236

237-
__slots__ = {
237+
__slots__ = [
238238
"name",
239239
"type",
240240
"default",
241241
"scope",
242-
}
242+
]
243243

244244
def __init__(self, spec: Dict[str, Any]):
245245
"""Initializes a JumpStartEnvironmentVariable object from its json representation.

tests/unit/sagemaker/jumpstart/test_cache.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -151,35 +151,35 @@ def test_jumpstart_cache_get_header():
151151
semantic_version_str="3.*",
152152
)
153153
assert (
154-
"Unable to find model manifest for tensorflow-ic-imagenet-inception-v3-classification-4 "
155-
"with version 3.* compatible with your SageMaker version (2.68.3). Consider upgrading "
156-
"your SageMaker library to at least version 4.49.0 so you can use version 3.0.0 of "
157-
"tensorflow-ic-imagenet-inception-v3-classification-4." in str(e.value)
154+
"Unable to find model manifest for 'tensorflow-ic-imagenet-inception-v3-classification-4' "
155+
"with version '3.*' compatible with your SageMaker version ('2.68.3'). Consider upgrading "
156+
"your SageMaker library to at least version '4.49.0' so you can use version '3.0.0' of "
157+
"'tensorflow-ic-imagenet-inception-v3-classification-4'." in str(e.value)
158158
)
159159

160160
with pytest.raises(KeyError) as e:
161161
cache.get_header(
162162
model_id="pytorch-ic-imagenet-inception-v3-classification-4", semantic_version_str="3.*"
163163
)
164164
assert (
165-
"Unable to find model manifest for pytorch-ic-imagenet-inception-v3-classification-4 with "
166-
"version 3.*. Consider using model id pytorch-ic-imagenet-inception-v3-classification-4 with "
167-
"version 2.0.0."
165+
"Unable to find model manifest for 'pytorch-ic-imagenet-inception-v3-classification-4' with "
166+
"version '3.*'. Consider using model ID 'pytorch-ic-imagenet-inception-v3-classification-4' with "
167+
"version '2.0.0'."
168168
) in str(e.value)
169169

170170
with pytest.raises(KeyError) as e:
171171
cache.get_header(model_id="pytorch-ic-", semantic_version_str="*")
172172
assert (
173-
"Unable to find model manifest for pytorch-ic- with version *. "
174-
"Did you mean to use model id pytorch-ic-imagenet-inception-v3-classification-4?"
173+
"Unable to find model manifest for 'pytorch-ic-' with version '*'. "
174+
"Did you mean to use model ID 'pytorch-ic-imagenet-inception-v3-classification-4'?"
175175
) in str(e.value)
176176

177177
with pytest.raises(KeyError) as e:
178178
cache.get_header(model_id="tensorflow-ic-", semantic_version_str="*")
179179
assert (
180-
"Unable to find model manifest for tensorflow-ic- with version *. "
181-
"Did you mean to use model id tensorflow-ic-imagenet-inception-"
182-
"v3-classification-4?"
180+
"Unable to find model manifest for 'tensorflow-ic-' with version '*'. "
181+
"Did you mean to use model ID 'tensorflow-ic-imagenet-inception-"
182+
"v3-classification-4'?"
183183
) in str(e.value)
184184

185185
with pytest.raises(KeyError):

0 commit comments

Comments
 (0)