Skip to content

Commit 6f30cbf

Browse files
author
Jonathan Makunga
committed
Remove Accelerated column if all not enabled
1 parent 469f17a commit 6f30cbf

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/sagemaker/jumpstart/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,4 +1084,6 @@ def extract_metrics_from_deployment_configs(
10841084
if column_name in data.keys():
10851085
data[column_name].append(benchmark_metric.get("value"))
10861086

1087+
if "Yes" not in data["Accelerated"]:
1088+
del data["Accelerated"]
10871089
return data

tests/unit/sagemaker/jumpstart/test_utils.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
get_special_model_spec,
5151
get_prototype_manifest,
5252
get_base_deployment_configs,
53+
get_base_deployment_configs_with_acceleration_configs,
5354
)
5455
from mock import MagicMock
5556

@@ -1763,10 +1764,11 @@ def test_get_jumpstart_benchmark_stats_training(
17631764

17641765

17651766
@pytest.mark.parametrize(
1766-
"config_name, expected",
1767+
"config_name, configs, expected",
17671768
[
17681769
(
17691770
None,
1771+
get_base_deployment_configs(),
17701772
{
17711773
"Config Name": [
17721774
"neuron-inference",
@@ -1776,7 +1778,6 @@ def test_get_jumpstart_benchmark_stats_training(
17761778
],
17771779
"Instance Type": ["ml.p2.xlarge", "ml.p2.xlarge", "ml.p2.xlarge", "ml.p2.xlarge"],
17781780
"Selected": ["No", "No", "No", "No"],
1779-
"Accelerated": ["Yes", "No", "No", "No"],
17801781
"Instance Rate (USD/Hrs)": [
17811782
"0.0083000000",
17821783
"0.0083000000",
@@ -1787,6 +1788,7 @@ def test_get_jumpstart_benchmark_stats_training(
17871788
),
17881789
(
17891790
"neuron-inference",
1791+
get_base_deployment_configs_with_acceleration_configs(),
17901792
{
17911793
"Config Name": [
17921794
"neuron-inference",
@@ -1807,12 +1809,7 @@ def test_get_jumpstart_benchmark_stats_training(
18071809
),
18081810
],
18091811
)
1810-
def test_extract_metrics_from_deployment_configs(config_name, expected):
1811-
configs = get_base_deployment_configs()
1812-
configs[0]["AccelerationConfigs"] = [
1813-
{"Type": "Speculative-Decoding", "Enabled": True, "Spec": {"Version": "0.1"}}
1814-
]
1815-
1812+
def test_extract_metrics_from_deployment_configs(config_name, configs, expected):
18161813
data = utils.extract_metrics_from_deployment_configs(configs, config_name)
18171814

18181815
assert data == expected

tests/unit/sagemaker/jumpstart/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ def get_base_deployment_configs() -> List[Dict[str, Any]]:
307307
return DEPLOYMENT_CONFIGS
308308

309309

310+
def get_base_deployment_configs_with_acceleration_configs() -> List[Dict[str, Any]]:
311+
configs = copy.deepcopy(DEPLOYMENT_CONFIGS)
312+
configs[0]["AccelerationConfigs"] = [
313+
{"Type": "Speculative-Decoding", "Enabled": True, "Spec": {"Version": "0.1"}}
314+
]
315+
return configs
316+
317+
310318
def get_mock_init_kwargs(model_id) -> JumpStartModelInitKwargs:
311319
return JumpStartModelInitKwargs(
312320
model_id=model_id,

0 commit comments

Comments
 (0)