Skip to content

Commit c593687

Browse files
fix: pass in inference_ami_version to model_based endpoint type (#5043)
* fix: pass in inference_ami_version to model_based endpoint type * documentation: update contributing.md w/ venv instructions and pip install fixes --------- Co-authored-by: Zhaoqi <[email protected]>
1 parent 903a5f2 commit c593687

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CONTRIBUTING.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Before sending us a pull request, please ensure that:
6161
1. Follow the instructions at [Modifying an EBS Volume Using Elastic Volumes (Console)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/requesting-ebs-volume-modifications.html#modify-ebs-volume) to increase the EBS volume size associated with the newly created EC2 instance.
6262
1. Wait 5-10min for the new EBS volume increase to finalize.
6363
1. Allow EC2 to claim the additional space by stopping and then starting your EC2 host.
64+
2. Set up a venv to manage dependencies:
65+
1. `python -m venv ~/.venv/myproject-env` to create the venv
66+
2. `source ~/.venv/myproject-env/bin/activate` to activate the venv
67+
3. `deactivate` to exit the venv
6468

6569

6670
### Pull Down the Code
@@ -74,8 +78,8 @@ Before sending us a pull request, please ensure that:
7478
### Run the Unit Tests
7579

7680
1. Install tox using `pip install tox`
77-
1. Install coverage using `pip install .[test]`
78-
1. cd into the sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
81+
1. cd into the github project sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
82+
1. Install coverage using `pip install '.[test]'`
7983
1. Run the following tox command and verify that all code checks and unit tests pass: `tox tests/unit`
8084
1. You can also run a single test with the following command: `tox -e py310 -- -s -vv <path_to_file><file_name>::<test_function_name>`
8185
1. You can run coverage via runcvoerage env : `tox -e runcoverage -- tests/unit` or `tox -e py310 -- tests/unit --cov=sagemaker --cov-append --cov-report xml`

src/sagemaker/model.py

+4
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,9 @@ def deploy(
14921492
}
14931493
model_reference_arn (Optional [str]): Hub Content Arn of a Model Reference type
14941494
content (default: None).
1495+
inference_ami_version (Optional [str]): Specifies an option from a collection of preconfigured
1496+
Amazon Machine Image (AMI) images. For a full list of options, see:
1497+
https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ProductionVariant.html
14951498
Raises:
14961499
ValueError: If arguments combination check failed in these circumstances:
14971500
- If no role is specified or
@@ -1743,6 +1746,7 @@ def deploy(
17431746
model_data_download_timeout=model_data_download_timeout,
17441747
container_startup_health_check_timeout=container_startup_health_check_timeout,
17451748
routing_config=routing_config,
1749+
inference_ami_version=inference_ami_version,
17461750
)
17471751
if endpoint_name:
17481752
self.endpoint_name = endpoint_name

tests/unit/sagemaker/model/test_deploy.py

+5
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def test_deploy(name_from_base, prepare_container_def, production_variant, sagem
130130
model_data_download_timeout=None,
131131
container_startup_health_check_timeout=None,
132132
routing_config=None,
133+
inference_ami_version=None,
133134
)
134135

135136
sagemaker_session.create_model.assert_called_with(
@@ -192,6 +193,7 @@ def test_deploy_accelerator_type(
192193
model_data_download_timeout=None,
193194
container_startup_health_check_timeout=None,
194195
routing_config=None,
196+
inference_ami_version=None,
195197
)
196198

197199
sagemaker_session.endpoint_from_production_variants.assert_called_with(
@@ -519,6 +521,7 @@ def test_deploy_serverless_inference(production_variant, create_sagemaker_model,
519521
model_data_download_timeout=None,
520522
container_startup_health_check_timeout=None,
521523
routing_config=None,
524+
inference_ami_version=None,
522525
)
523526

524527
sagemaker_session.endpoint_from_production_variants.assert_called_with(
@@ -956,6 +959,7 @@ def test_deploy_customized_volume_size_and_timeout(
956959
model_data_download_timeout=model_data_download_timeout_sec,
957960
container_startup_health_check_timeout=startup_health_check_timeout_sec,
958961
routing_config=None,
962+
inference_ami_version=None,
959963
)
960964

961965
sagemaker_session.create_model.assert_called_with(
@@ -1006,6 +1010,7 @@ def test_deploy_with_resources(sagemaker_session, name_from_base, production_var
10061010
model_data_download_timeout=None,
10071011
container_startup_health_check_timeout=None,
10081012
routing_config=None,
1013+
inference_ami_version=None,
10091014
)
10101015
sagemaker_session.endpoint_from_production_variants.assert_called_with(
10111016
name=name_from_base(MODEL_NAME),

0 commit comments

Comments
 (0)