Skip to content

Commit a5409a8

Browse files
Merge branch 'master' into update-hf-neuronx-dlcs
2 parents 2a6f1b1 + bfbb35f commit a5409a8

File tree

91 files changed

+11596
-1913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+11596
-1913
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## v2.154.0 (2023-05-11)
4+
5+
### Features
6+
7+
* Add integ tests for remote_function, auto_capture functionality
8+
* jumpstart model estimator classes
9+
10+
### Bug Fixes and Other Changes
11+
12+
* integs - pytorch transformer deps and add test retry
13+
* adding .lower() so new Pandas dtypes will match the type lookup.
14+
* Pass KMS value to create processing job
15+
16+
## v2.153.0 (2023-05-09)
17+
18+
### Features
19+
20+
* Support npz archives in NumpyDeserializer
21+
* Add FasterTransformer DJL support
22+
* support for Sample Weights for SageMaker Autopilot
23+
24+
### Bug Fixes and Other Changes
25+
26+
* retry is_run assertion
27+
* Avoid 'AttributeError' for endpoint_name, if deploy() is not yet called
28+
* Fix LambdaStep Creation
29+
* Fix error when instance_count>1 in remote_function
30+
* Remove deprecated update_endpoint from deploy() args in TensorFlowModel
31+
* Update DJL deepspeed and fastertransformer DLC image uris
32+
* remote_function python version mismatch issue
33+
334
## v2.152.0 (2023-05-04)
435

536
### Features

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.152.1.dev0
1+
2.154.1.dev0

src/sagemaker/accept_types.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""This module is for SageMaker accept types."""
14+
from __future__ import absolute_import
15+
from typing import List, Optional
16+
17+
from sagemaker.jumpstart import artifacts, utils as jumpstart_utils
18+
19+
20+
def retrieve_options(
21+
region: Optional[str] = None,
22+
model_id: Optional[str] = None,
23+
model_version: Optional[str] = None,
24+
tolerate_vulnerable_model: bool = False,
25+
tolerate_deprecated_model: bool = False,
26+
) -> List[str]:
27+
"""Retrieves the supported accept types for the model matching the given arguments.
28+
29+
Args:
30+
region (str): The AWS Region for which to retrieve the supported accept types.
31+
Defaults to ``None``.
32+
model_id (str): The model ID of the model for which to
33+
retrieve the supported accept types. (Default: None).
34+
model_version (str): The version of the model for which to retrieve the
35+
supported accept types. (Default: None).
36+
tolerate_vulnerable_model (bool): True if vulnerable versions of model
37+
specifications should be tolerated (exception not raised). If False, raises an
38+
exception if the script used by this version of the model has dependencies with known
39+
security vulnerabilities. (Default: False).
40+
tolerate_deprecated_model (bool): True if deprecated models should be tolerated
41+
(exception not raised). False if these models should raise an exception.
42+
(Default: False).
43+
Returns:
44+
list: The supported accept types to use for the model.
45+
46+
Raises:
47+
ValueError: If the combination of arguments specified is not supported.
48+
"""
49+
if not jumpstart_utils.is_jumpstart_model_input(model_id, model_version):
50+
raise ValueError(
51+
"Must specify JumpStart `model_id` and `model_version` when retrieving accept types."
52+
)
53+
54+
return artifacts._retrieve_supported_accept_types(
55+
model_id,
56+
model_version,
57+
region,
58+
tolerate_vulnerable_model,
59+
tolerate_deprecated_model,
60+
)
61+
62+
63+
def retrieve_default(
64+
region: Optional[str] = None,
65+
model_id: Optional[str] = None,
66+
model_version: Optional[str] = None,
67+
tolerate_vulnerable_model: bool = False,
68+
tolerate_deprecated_model: bool = False,
69+
) -> str:
70+
"""Retrieves the default accept type for the model matching the given arguments.
71+
72+
Args:
73+
region (str): The AWS Region for which to retrieve the default accept type.
74+
Defaults to ``None``.
75+
model_id (str): The model ID of the model for which to
76+
retrieve the default accept type. (Default: None).
77+
model_version (str): The version of the model for which to retrieve the
78+
default accept type. (Default: None).
79+
tolerate_vulnerable_model (bool): True if vulnerable versions of model
80+
specifications should be tolerated (exception not raised). If False, raises an
81+
exception if the script used by this version of the model has dependencies with known
82+
security vulnerabilities. (Default: False).
83+
tolerate_deprecated_model (bool): True if deprecated models should be tolerated
84+
(exception not raised). False if these models should raise an exception.
85+
(Default: False).
86+
Returns:
87+
str: The default accept type to use for the model.
88+
89+
Raises:
90+
ValueError: If the combination of arguments specified is not supported.
91+
"""
92+
if not jumpstart_utils.is_jumpstart_model_input(model_id, model_version):
93+
raise ValueError(
94+
"Must specify JumpStart `model_id` and `model_version` when retrieving accept types."
95+
)
96+
97+
return artifacts._retrieve_default_accept_type(
98+
model_id,
99+
model_version,
100+
region,
101+
tolerate_vulnerable_model,
102+
tolerate_deprecated_model,
103+
)

0 commit comments

Comments
 (0)