Skip to content

Commit 9a7b6de

Browse files
chrstfupintaoz-awsmalav-shastrimalavhsCaptainia
committed
chore: Merge from main (#1600)
* prepare release v2.232.2 * update development version to v2.232.3.dev0 * fix: Use Miniforge to replace MambaForge (#4884) * Use Miniforge to replace MambaForge * Fix download url * tests: Implement integration tests covering JumpStart PrivateHub workflows (#4883) * tests: Implement integration tests covering JumpStart PrivateHub workflows * linting * formating * Only delete the pytest session specific test * change scope to session * address nits * Address test failures * address typo * address comments * resolve flake8 errors * implement throttle handling * flake8 * flake8 * Adding more assertions --------- Co-authored-by: malavhs <[email protected]> * chore: add lmi image config in me-central-1 (#4887) * changes for PT 2.4 currency upgrade (#4890) Co-authored-by: Andrew Tian <[email protected]> * chore(deps): bump pyspark from 3.3.1 to 3.3.2 in /requirements/extras (#4894) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update cloudpickle version to >=2.2.1 (#4891) * update cloudpickle version to >=2.2.1 in pyproject.toml (#4899) * Revert "update cloudpickle version to >=2.2.1 in pyproject.toml (#4899)" (#4902) * release: huggingface tgi neuronx 0.0.25 image (#4893) * release: huggingface tgi neuronx 0.0.25 image * tests * add tgi 2.3.1 * update default version * update py version * fix tests * test * Revert "fix tests" This reverts commit 9374c75. * Revert "Revert "fix tests"" This reverts commit 20d46d1. * Revert "test" This reverts commit 90f6e0b. * fix: fixing typo in dependecy setup (#4905) charset-normalizer is misplet in the requirements.txt files * Fix: Returning ModelPackage object on register of PipelineModel (#4878) Co-authored-by: Keshav Chandak <[email protected]> * fix: modified pull request template (#4906) Added warning to spell check dependencies added and ensure they exist in PyPi * Fix: image_uris graviton image uri (#4909) * change: update image_uri_configs 09-27-2024 07:18:01 PST * change: update image_uri_configs 10-03-2024 07:17:59 PST * change: update image_uri_configs 10-17-2024 07:17:55 PST * change: update image_uri_configs 10-23-2024 11:26:03 PST * change: adding eu-central-2 bucket info to JS constants (#4907) * change: adding eu-central-2 bucket info to JS constants * change: adding zrh image uris for dji neuronx --------- Co-authored-by: shaernev <[email protected]> * fix: Skip pytorch tests incompatible with latest version 2.4.0 (#4910) * change: update image_uri_configs 10-29-2024 07:17:56 PST * prepare release v2.232.3 * update development version to v2.232.4.dev0 * change: Updates for DJL 0.30.0 release (#4892) Co-authored-by: pintaoz-aws <[email protected]> * bumping smp version from 2.6.0 to 2.6.1 (#4913) Co-authored-by: Andrew Tian <[email protected]> Co-authored-by: nileshvd <[email protected]> * feat: Marketplace model support in HubService (#4916) * feat: Marketplace model support in HubService * fix: removing field * fix: Reverting name change for code coverage * fix: Adding more code coverage * fix: linting * fix: Fixing coverage tests * fix: Fixing integration tests * fix: Minor fixes * feat: triton v24.09 (#4908) * fix: Fixing JumpStart Tests (#4917) * fix: Fixing tests * fix: fixing test name * fix: dummy commit * fix: reverting dummy commit * fix: Removing flakey tests --------- Co-authored-by: nileshvd <[email protected]> * fix: merge * fix: Commenting out marketplace test * fix: Linting --------- Co-authored-by: ci <ci> Co-authored-by: pintaoz-aws <[email protected]> Co-authored-by: Malav Shastri <[email protected]> Co-authored-by: malavhs <[email protected]> Co-authored-by: Haotian An <[email protected]> Co-authored-by: adtian2 <[email protected]> Co-authored-by: Andrew Tian <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: liujiaor <[email protected]> Co-authored-by: ASHWIN KRISHNA <[email protected]> Co-authored-by: Keshav Chandak <[email protected]> Co-authored-by: Keshav Chandak <[email protected]> Co-authored-by: Erick Benitez-Ramos <[email protected]> Co-authored-by: sagemaker-bot <[email protected]> Co-authored-by: Ernev Sharma <[email protected]> Co-authored-by: shaernev <[email protected]> Co-authored-by: Tyler Osterberg <[email protected]> Co-authored-by: nileshvd <[email protected]> Co-authored-by: Aaqib <[email protected]>
1 parent eb3f92c commit 9a7b6de

File tree

9 files changed

+65
-39
lines changed

9 files changed

+65
-39
lines changed

requirements/extras/test_requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ pyvis==0.2.1
2525
pandas==1.4.4
2626
scikit-learn==1.3.0
2727
cloudpickle>=2.2.1
28+
<<<<<<< HEAD
2829
jsonpickle<4.0.0
30+
=======
31+
>>>>>>> 42acb4f4 (chore: Merge from main (#1600))
2932
PyYAML==6.0
3033
# TODO find workaround
3134
xgboost>=1.6.2,<=1.7.6

src/sagemaker/jumpstart/hub/parser_utils.py

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from typing import Any, Dict, List, Optional
1919

2020

21+
<<<<<<< HEAD
2122
<<<<<<< HEAD
2223
def camel_to_snake(camel_case_string: str) -> str:
2324
"""Converts camelCase to snake_case_string using a regex.
@@ -29,6 +30,12 @@ def pascal_to_snake(camel_case_string: str) -> str:
2930

3031
This regex cannot handle whitespace ("PascalString TwoWords")
3132
>>>>>>> ff3eae05 (feat: Adding Bedrock Store model support for HubService (#1539))
33+
=======
34+
def camel_to_snake(camel_case_string: str) -> str:
35+
"""Converts camelCase to snake_case_string using a regex.
36+
37+
This regex cannot handle whitespace ("camelString TwoWords")
38+
>>>>>>> 42acb4f4 (chore: Merge from main (#1600))
3239
"""
3340
return re.sub(r"(?<!^)(?=[A-Z])", "_", camel_case_string).lower()
3441

src/sagemaker/jumpstart/hub/parsers.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
HubModelDocument,
2828
)
2929
from sagemaker.jumpstart.hub.parser_utils import (
30-
pascal_to_snake,
30+
camel_to_snake,
3131
snake_to_upper_camel,
3232
walk_and_apply_json,
3333
)
@@ -86,7 +86,7 @@ def get_model_spec_arg_keys(
8686
arg_keys = []
8787

8888
if naming_convention == NamingConventionType.SNAKE_CASE:
89-
arg_keys = [pascal_to_snake(key) for key in arg_keys]
89+
arg_keys = [camel_to_snake(key) for key in arg_keys]
9090
elif naming_convention == NamingConventionType.UPPER_CAMEL_CASE:
9191
return arg_keys
9292
else:
@@ -207,7 +207,7 @@ def make_model_specs_from_describe_hub_content_response(
207207
default_payloads: Dict[str, Any] = {}
208208
if hub_model_document.default_payloads is not None:
209209
for alias, payload in hub_model_document.default_payloads.items():
210-
default_payloads[alias] = walk_and_apply_json(payload.to_json(), pascal_to_snake)
210+
default_payloads[alias] = walk_and_apply_json(payload.to_json(), camel_to_snake)
211211
specs["default_payloads"] = default_payloads
212212
specs["gated_bucket"] = hub_model_document.gated_bucket
213213
specs["inference_volume_size"] = hub_model_document.inference_volume_size

src/sagemaker/jumpstart/hub/utils.py

+12
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,29 @@ def get_hub_model_version(
219219
except Exception as ex:
220220
raise Exception(f"Failed calling list_hub_content_versions: {str(ex)}")
221221

222+
<<<<<<< HEAD
222223
<<<<<<< HEAD
223224
=======
224225
marketplace_hub_content_version = _get_hub_model_version_for_marketplace_version(
225226
hub_content_summaries, hub_model_version
226227
)
227228

228229
>>>>>>> ff3eae05 (feat: Adding Bedrock Store model support for HubService (#1539))
230+
=======
231+
>>>>>>> 42acb4f4 (chore: Merge from main (#1600))
229232
try:
230233
return _get_hub_model_version_for_open_weight_version(
231234
hub_content_summaries, hub_model_version
232235
)
233236
<<<<<<< HEAD
237+
<<<<<<< HEAD
238+
=======
239+
>>>>>>> 42acb4f4 (chore: Merge from main (#1600))
234240
except KeyError:
235241
marketplace_hub_content_version = _get_hub_model_version_for_marketplace_version(
236242
hub_content_summaries, hub_model_version
237243
)
244+
<<<<<<< HEAD
238245
if marketplace_hub_content_version:
239246
return marketplace_hub_content_version
240247
raise
@@ -244,6 +251,11 @@ def get_hub_model_version(
244251
return marketplace_hub_content_version
245252
raise e
246253
>>>>>>> ff3eae05 (feat: Adding Bedrock Store model support for HubService (#1539))
254+
=======
255+
if marketplace_hub_content_version:
256+
return marketplace_hub_content_version
257+
raise
258+
>>>>>>> 42acb4f4 (chore: Merge from main (#1600))
247259

248260

249261
def _get_hub_model_version_for_open_weight_version(

src/sagemaker/jumpstart/types.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from sagemaker.compute_resource_requirements.resource_requirements import ResourceRequirements
4141
from sagemaker.enums import EndpointType
4242
from sagemaker.jumpstart.hub.parser_utils import (
43-
pascal_to_snake,
43+
camel_to_snake,
4444
walk_and_apply_json,
4545
)
4646
from sagemaker.model_life_cycle import ModelLifeCycle
@@ -241,7 +241,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
241241
return
242242

243243
if self._is_hub_content:
244-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
244+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
245245

246246
self.framework = json_obj.get("framework")
247247
self.framework_version = json_obj.get("framework_version")
@@ -295,7 +295,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
295295
"""
296296

297297
if self._is_hub_content:
298-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
298+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
299299
self.name = json_obj["name"]
300300
self.type = json_obj["type"]
301301
self.default = json_obj["default"]
@@ -363,7 +363,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
363363
Args:
364364
json_obj (Dict[str, Any]): Dictionary representation of environment variable.
365365
"""
366-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
366+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
367367
self.name = json_obj["name"]
368368
self.type = json_obj["type"]
369369
self.default = json_obj["default"]
@@ -413,7 +413,7 @@ def from_json(self, json_obj: Optional[Dict[str, Any]]) -> None:
413413
return
414414

415415
if self._is_hub_content:
416-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
416+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
417417
self.default_content_type = json_obj["default_content_type"]
418418
self.supported_content_types = json_obj["supported_content_types"]
419419
self.default_accept_type = json_obj["default_accept_type"]
@@ -467,7 +467,7 @@ def from_json(self, json_obj: Optional[Dict[str, Any]]) -> None:
467467
return
468468

469469
if self._is_hub_content:
470-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
470+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
471471
self.raw_payload = json_obj
472472
self.content_type = json_obj["content_type"]
473473
self.body = json_obj.get("body")
@@ -540,7 +540,7 @@ def from_describe_hub_content_response(self, response: Optional[Dict[str, Any]])
540540
if response is None:
541541
return
542542

543-
response = walk_and_apply_json(response, pascal_to_snake)
543+
response = walk_and_apply_json(response, camel_to_snake)
544544
self.aliases: Optional[dict] = response.get("aliases")
545545
self.regional_aliases = None
546546
self.variants: Optional[dict] = response.get("variants")
@@ -1180,7 +1180,7 @@ def __init__(self, spec: Optional[Dict[str, Any]], is_hub_content=False):
11801180
spec (Dict[str, Any]): Dictionary representation of training config ranking.
11811181
"""
11821182
if is_hub_content:
1183-
spec = walk_and_apply_json(spec, pascal_to_snake)
1183+
spec = walk_and_apply_json(spec, camel_to_snake)
11841184
self.from_json(spec)
11851185

11861186
def from_json(self, json_obj: Dict[str, Any]) -> None:
@@ -1286,7 +1286,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
12861286
json_obj (Dict[str, Any]): Dictionary representation of spec.
12871287
"""
12881288
if self._is_hub_content:
1289-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
1289+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
12901290
self.model_id: str = json_obj.get("model_id")
12911291
self.url: str = json_obj.get("url")
12921292
self.version: str = json_obj.get("version")
@@ -1515,7 +1515,7 @@ def __init__(
15151515
ValueError: If the component field is invalid.
15161516
"""
15171517
if is_hub_content:
1518-
component = walk_and_apply_json(component, pascal_to_snake)
1518+
component = walk_and_apply_json(component, camel_to_snake)
15191519
self.component_name = component_name
15201520
super().__init__(component, is_hub_content)
15211521
self.from_json(component)
@@ -1568,8 +1568,8 @@ def __init__(
15681568
The list of components that are used to construct the resolved config.
15691569
"""
15701570
if is_hub_content:
1571-
config = walk_and_apply_json(config, pascal_to_snake)
1572-
base_fields = walk_and_apply_json(base_fields, pascal_to_snake)
1571+
config = walk_and_apply_json(config, camel_to_snake)
1572+
base_fields = walk_and_apply_json(base_fields, camel_to_snake)
15731573
self.base_fields = base_fields
15741574
self.config_components: Dict[str, JumpStartConfigComponent] = config_components
15751575
self.benchmark_metrics: Dict[str, List[JumpStartBenchmarkStat]] = (
@@ -1735,7 +1735,7 @@ def from_json(self, json_obj: Dict[str, Any]) -> None:
17351735
"""
17361736
super().from_json(json_obj)
17371737
if self._is_hub_content:
1738-
json_obj = walk_and_apply_json(json_obj, pascal_to_snake)
1738+
json_obj = walk_and_apply_json(json_obj, camel_to_snake)
17391739
self.inference_config_components: Optional[Dict[str, JumpStartConfigComponent]] = (
17401740
{
17411741
component_name: JumpStartConfigComponent(component_name, component)

src/sagemaker/jumpstart/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
from sagemaker.jumpstart import constants, enums
3737
from sagemaker.jumpstart import accessors
38-
from sagemaker.jumpstart.hub.parser_utils import pascal_to_snake, snake_to_upper_camel
38+
from sagemaker.jumpstart.hub.parser_utils import camel_to_snake, snake_to_upper_camel
3939
from sagemaker.s3 import parse_s3_url
4040
from sagemaker.jumpstart.exceptions import (
4141
DeprecatedJumpStartModelError,
@@ -1178,7 +1178,7 @@ def get_jumpstart_configs(
11781178
return (
11791179
{
11801180
config_name: metadata_configs.configs[
1181-
pascal_to_snake(snake_to_upper_camel(config_name))
1181+
camel_to_snake(snake_to_upper_camel(config_name))
11821182
]
11831183
for config_name in config_names
11841184
}

tests/integ/sagemaker/jumpstart/model/test_jumpstart_model.py

+20-19
Original file line numberDiff line numberDiff line change
@@ -513,25 +513,26 @@ def test_model_reference_marketplace_model(setup):
513513
assert model_semver.model_version == model_marketplace_version.model_version
514514

515515

516-
def test_model_reference_marketplace_model_deployment(setup):
517-
session = get_sm_session()
518-
public_hub_marketplace_model_id = "upstage-solar-mini-chat"
519-
_setup_test_hub_with_reference(public_hub_marketplace_model_id)
520-
521-
marketplace_model = JumpStartModel( # Retrieving MP model MP version -> uses MPver
522-
model_id=public_hub_marketplace_model_id,
523-
hub_name=TEST_HUB_WITH_REFERENCE,
524-
role=session.get_caller_identity_arn(),
525-
sagemaker_session=session,
526-
model_version="240612.5",
527-
)
528-
predictor = marketplace_model.deploy(
529-
tags=[{"Key": JUMPSTART_TAG, "Value": os.environ[ENV_VAR_JUMPSTART_SDK_TEST_SUITE_ID]}],
530-
accept_eula=True,
531-
)
532-
533-
predictor.delete_predictor()
534-
_teardown_test_hub_with_reference(public_hub_marketplace_model_id)
516+
# TODO: PySDK test account not subscribed to this model
517+
# def test_model_reference_marketplace_model_deployment(setup):
518+
# session = get_sm_session()
519+
# public_hub_marketplace_model_id = "upstage-solar-mini-chat"
520+
# _setup_test_hub_with_reference(public_hub_marketplace_model_id)
521+
522+
# marketplace_model = JumpStartModel( # Retrieving MP model MP version -> uses MPver
523+
# model_id=public_hub_marketplace_model_id,
524+
# hub_name=TEST_HUB_WITH_REFERENCE,
525+
# role=session.get_caller_identity_arn(),
526+
# sagemaker_session=session,
527+
# model_version="240612.5",
528+
# )
529+
# predictor = marketplace_model.deploy(
530+
# tags=[{"Key": JUMPSTART_TAG, "Value": os.environ[ENV_VAR_JUMPSTART_SDK_TEST_SUITE_ID]}],
531+
# accept_eula=True,
532+
# )
533+
534+
# predictor.delete_predictor()
535+
# _teardown_test_hub_with_reference(public_hub_marketplace_model_id)
535536

536537

537538
def test_bedrock_store_model_tags_from_hub_service(setup):

tests/integ/sagemaker/jumpstart/utils.py

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def get_sm_session() -> Session:
5353
return Session(boto_session=boto3.Session(region_name=JUMPSTART_DEFAULT_REGION_NAME))
5454

5555

56+
<<<<<<< HEAD
5657
<<<<<<< HEAD
5758
=======
5859
def get_sm_session_with_override() -> Session:
@@ -70,6 +71,8 @@ def get_sm_session_with_override() -> Session:
7071

7172

7273
>>>>>>> ff3eae05 (feat: Adding Bedrock Store model support for HubService (#1539))
74+
=======
75+
>>>>>>> 42acb4f4 (chore: Merge from main (#1600))
7376
def get_training_dataset_for_model_and_version(model_id: str, version: str) -> dict:
7477
return TRAINING_DATASET_MODEL_DICT[(model_id, version)]
7578

tests/unit/sagemaker/jumpstart/hub/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_walk_and_apply_json():
268268
}
269269

270270
result = parser_utils.walk_and_apply_json(
271-
test_json, parser_utils.pascal_to_snake, ["ignore_my_children"]
271+
test_json, parser_utils.camel_to_snake, ["ignore_my_children"]
272272
)
273273
assert result == {
274274
"camel_case_key": "value",
@@ -294,7 +294,7 @@ def test_walk_and_apply_json_no_stop():
294294
"CamelCaseObjectListKey": {"instance.ml.type.xlarge": [{"ShouldChangeMe": "string"}]},
295295
}
296296

297-
result = parser_utils.walk_and_apply_json(test_json, parser_utils.pascal_to_snake)
297+
result = parser_utils.walk_and_apply_json(test_json, parser_utils.camel_to_snake)
298298
assert result == {
299299
"camel_case_key": "value",
300300
"camel_case_object_key": {

0 commit comments

Comments
 (0)