Skip to content

fix: pass in inference_ami_version to model_based endpoint type #5043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Before sending us a pull request, please ensure that:
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.
1. Wait 5-10min for the new EBS volume increase to finalize.
1. Allow EC2 to claim the additional space by stopping and then starting your EC2 host.
2. Set up a venv to manage dependencies:
1. `python -m venv ~/.venv/myproject-env` to create the venv
2. `source ~/.venv/myproject-env/bin/activate` to activate the venv
3. `deactivate` to exit the venv


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

1. Install tox using `pip install tox`
1. Install coverage using `pip install .[test]`
1. cd into the sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
1. cd into the github project sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
1. Install coverage using `pip install '.[test]'`
1. Run the following tox command and verify that all code checks and unit tests pass: `tox tests/unit`
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>`
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`
Expand Down
4 changes: 4 additions & 0 deletions src/sagemaker/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,9 @@ def deploy(
}
model_reference_arn (Optional [str]): Hub Content Arn of a Model Reference type
content (default: None).
inference_ami_version (Optional [str]): Specifies an option from a collection of preconfigured
Amazon Machine Image (AMI) images. For a full list of options, see:
https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ProductionVariant.html
Raises:
ValueError: If arguments combination check failed in these circumstances:
- If no role is specified or
Expand Down Expand Up @@ -1743,6 +1746,7 @@ def deploy(
model_data_download_timeout=model_data_download_timeout,
container_startup_health_check_timeout=container_startup_health_check_timeout,
routing_config=routing_config,
inference_ami_version=inference_ami_version,
)
if endpoint_name:
self.endpoint_name = endpoint_name
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/sagemaker/model/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_deploy(name_from_base, prepare_container_def, production_variant, sagem
model_data_download_timeout=None,
container_startup_health_check_timeout=None,
routing_config=None,
inference_ami_version=None,
)

sagemaker_session.create_model.assert_called_with(
Expand Down Expand Up @@ -192,6 +193,7 @@ def test_deploy_accelerator_type(
model_data_download_timeout=None,
container_startup_health_check_timeout=None,
routing_config=None,
inference_ami_version=None,
)

sagemaker_session.endpoint_from_production_variants.assert_called_with(
Expand Down Expand Up @@ -519,6 +521,7 @@ def test_deploy_serverless_inference(production_variant, create_sagemaker_model,
model_data_download_timeout=None,
container_startup_health_check_timeout=None,
routing_config=None,
inference_ami_version=None,
)

sagemaker_session.endpoint_from_production_variants.assert_called_with(
Expand Down Expand Up @@ -956,6 +959,7 @@ def test_deploy_customized_volume_size_and_timeout(
model_data_download_timeout=model_data_download_timeout_sec,
container_startup_health_check_timeout=startup_health_check_timeout_sec,
routing_config=None,
inference_ami_version=None,
)

sagemaker_session.create_model.assert_called_with(
Expand Down Expand Up @@ -1006,6 +1010,7 @@ def test_deploy_with_resources(sagemaker_session, name_from_base, production_var
model_data_download_timeout=None,
container_startup_health_check_timeout=None,
routing_config=None,
inference_ami_version=None,
)
sagemaker_session.endpoint_from_production_variants.assert_called_with(
name=name_from_base(MODEL_NAME),
Expand Down
Loading