Skip to content

Commit 87c2563

Browse files
chad119Chad Chiangnargokul
authored andcommitted
Fix: remove the special condition and fix the unit test (#1601)
* Fix: move the functionality from latest_container_image to retrieve * address some comments from Gokul and add unit test * remove extra functions and rewrite the test * fix unit test * fix for other unit test * unit test fix * fix unit test: add one more condition * more unit tests fix * remove redundant files * remove the special condition and fix the unit test --------- Co-authored-by: Chad Chiang <[email protected]> Co-authored-by: Gokul Anantha Narayanan <[email protected]>
1 parent 107f8e9 commit 87c2563

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/sagemaker/image_uris.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,7 @@ def _validate_version_and_set_if_needed(version, config, framework, image_scope)
496496
aliased_versions = list(config.get("version_aliases", {}).keys())
497497
if len(available_versions) == 1 and version not in aliased_versions:
498498
return available_versions[0]
499-
if not version and framework in [
500-
DATA_WRANGLER_FRAMEWORK,
501-
HUGGING_FACE_LLM_FRAMEWORK,
502-
HUGGING_FACE_TEI_GPU_FRAMEWORK,
503-
HUGGING_FACE_TEI_CPU_FRAMEWORK,
504-
HUGGING_FACE_LLM_NEURONX_FRAMEWORK,
505-
STABILITYAI_FRAMEWORK,
506-
]:
499+
if not version:
507500
version = _get_latest_version(framework, version, image_scope)
508501
_validate_arg(version, available_versions + aliased_versions, "{} version".format(framework))
509502
return version

tests/unit/sagemaker/serve/detector/test_image_detector.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_detect_latest_downcast_xgb(self):
4747
xgb_model = Mock()
4848
xgb_model.__class__.__bases__ = (xgboost,)
4949
self.assert_dlc_is_expected(
50-
"246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.7-1", xgb_model
50+
"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:1.7-1", xgb_model
5151
)
5252

5353
@patch.dict(sys.modules, {"xgboost": MagicMock(__version__="1.6.5")})
@@ -57,7 +57,7 @@ def test_detect_earliest_upcast_xgb(self, platform):
5757
xgb_model = Mock()
5858
xgb_model.__class__.__bases__ = (xgboost,)
5959
self.assert_dlc_is_expected(
60-
"246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.7-1", xgb_model
60+
"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:1.7-1", xgb_model
6161
)
6262

6363
@patch.dict(sys.modules, {"xgboost": MagicMock(__version__="1.5.1")})
@@ -67,7 +67,7 @@ def test_detect_exact_match_xgb(self, platform):
6767
xgb_model = Mock()
6868
xgb_model.__class__.__bases__ = (xgboost,)
6969
self.assert_dlc_is_expected(
70-
"246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.5-1", xgb_model
70+
"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:1.5-1", xgb_model
7171
)
7272

7373
# Test Torch Success
@@ -202,7 +202,7 @@ def test_detect_model_no_base(self, platform):
202202
xgb_model = Mock()
203203
xgb_model.__class__ = xgboost
204204
self.assert_dlc_is_expected(
205-
"246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost:1.7-1", xgb_model
205+
"433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:1.7-1", xgb_model
206206
)
207207

208208
# helpers

0 commit comments

Comments
 (0)