-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
PyTorchcomponent: hostingRelates to the SageMaker Hosting PlatformRelates to the SageMaker Hosting Platformtype: bug
Description
Describe the bug
sagemake.pytorch.PyTorchModel
requires framework_version
even if image_uri
is provided.
To reproduce
pytorch_inference_image_uri = sagemaker.image_uris.retrieve(
'pytorch',
region=SM_REGION,
version='1.7.1',
py_version='py3',
instance_type='ml.c5.xlarge',
accelerator_type=None,
image_scope='inference')
sm_model = PyTorchModel(
model_data=model_artifact_s3,
role=IAM_ROLE,
entry_point='inference.py',
# framework_version='1.7.1', # <--- fails if commented
image_uri=pytorch_inference_image_uri)
print('Deploying endpoint..')
predictor = sm_model.deploy(
initial_instance_count=1,
instance_type='local',
)
Expected behavior
From documentation: "ramework_version (str): PyTorch version you want to use for executing your model training code. Defaults to None. Required unless image_uri
is provided."
This is also the observed behaviour in other framework models.
Screenshots or logs
Traceback (most recent call last):
File "/Users/***/WORK/Repos/sagemaker-python-sdk/src/dev_local.py", line 79, in <module>
run()
File "/Users/***/WORK/Repos/sagemaker-python-sdk/src/dev_local.py", line 38, in run
predictor = sm_model.deploy(
File "/Users/***/WORK/Repos/sagemaker-python-sdk/src/sagemaker/model.py", line 992, in deploy
self._create_sagemaker_model(instance_type, accelerator_type, tags)
File "/Users/***/WORK/Repos/sagemaker-python-sdk/src/sagemaker/model.py", line 523, in _create_sagemaker_model
container_def = self.prepare_container_def(instance_type, accelerator_type=accelerator_type)
File "/Users/***/WORK/Repos/sagemaker-python-sdk/src/sagemaker/pytorch/model.py", line 252, in prepare_container_def
self._upload_code(deploy_key_prefix, repack=self._is_mms_version())
File "/Users/***/WORK/Repos/sagemaker-python-sdk/src/sagemaker/pytorch/model.py", line 297, in _is_mms_version
framework_version = packaging.version.Version(self.framework_version)
File "/Users/***/miniconda/envs/pt18/lib/python3.8/site-packages/packaging/version.py", line 264, in __init__
match = self._regex.search(version)
System information
- SageMaker Python SDK version: 2.80.0
- Framework name (eg. PyTorch) or algorithm (eg. KMeans): PyTorch
- Framework version:
- Python version: 3.8.12
- CPU or GPU:
- Custom Docker image (Y/N): N
Additional context
Issue in sagemake.pytorch.PyTorchModel._is_mms_version(...)
: no logic to cover the None
value of framework_version
.
Metadata
Metadata
Assignees
Labels
PyTorchcomponent: hostingRelates to the SageMaker Hosting PlatformRelates to the SageMaker Hosting Platformtype: bug