Closed sachanub closed 10 months ago
I notice we don't have local integration test. Is there any use case we want to cover in local integration test?
I didn't see user script overwrites input_fn
or output_fn
. Do we want to add those tests?
I notice we don't have local integration test. Is there any use case we want to cover in local integration test?
Added the following local integration tests:
context
object in model_fn
.I didn't see user script overwrites
input_fn
oroutput_fn
. Do we want to add those tests?
We define custom input_fn
and output_fn
for this test: https://github.com/aws/sagemaker-pytorch-inference-toolkit/blob/master/test/integration/local/test_serving.py#L87. This script defines custom input_fn
and output_fn
functions: https://github.com/aws/sagemaker-pytorch-inference-toolkit/blob/master/test/resources/mnist/model_cpu/code/call_model_fn_once.py
Issue #, if available:
Description of changes:
The objective of this PR is to add new unit and integration tests. Specifically, we include the following:
ts_environment.py
:test/unit/test_ts_environment.py
test/integration/sagemaker/test_mnist_inductor.py
test/resources/mnist/model_inductor
:code/mnist.py
andtorch_model.pth
test/integration/__init__.py
:test/integration/sagemaker/test_mnist_inductor.py
:test/integration/sagemaker/test_multi_model_endpoint_sagemaker.py
test/resources/mme
:test/resources/resnet18/default_model
.test/resources/resnet18/default_traced_resnet
.test/integration/__init__.py
:test/integration/sagemaker/test_multi_model_endpoint_sagemaker.py
:requirements.txt
are installed:requirements.txt
file: This file has thetransformers
dependency.test/resources/mnist/model_cpu/code/requirements.txt
.transformers
in the following script:test/resources/mnist/model_cpu/code/mnist.py
.test/integration/__init__.py
:test/utils/file_utils.py
:Added logic to include
requirements.txt
in tar file creation.UPDATE:
test/integration/__init__.py
to obtain model information fromtest/integration/all_models_info.json
and iteratively create attributes for the model directory, model script name and model tar file.Added the following local integration tests:
test/integration/sagemaker/test_multi_model_endpoint_local.py
:test/integration/__init__.py
:model_gpu_context
.test/resources/model_gpu_context/code/inference.py
:model_fn
,input_fn
,predict_fn
andoutput_fn
to dynamically get all the GPU IDs from thecontext
object and their corresponding PIDs and thread IDs and write them in different CSV files. Return dummy values from the functions.test/integration/local/test_model_fn_context.py
:context
object in themodel_fn
,input_fn
,predict_fn
andoutput_fn
functions by reading from the CSV files created intest/resources/model_gpu_context/code/inference.py
.model_fn
,input_fn
,predict_fn
,output_fn
functions.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.