aws / sagemaker-python-sdk

A library for training and deploying machine learning models on Amazon SageMaker
https://sagemaker.readthedocs.io/
Apache License 2.0
2.11k stars 1.14k forks source link

TypeError: can't convert np.ndarray of type numpy.object. #4930

Open payamahmadvand-stemcell opened 1 week ago

payamahmadvand-stemcell commented 1 week ago

I am making an endpoint with this images on AWS sagemaker 763104351884.dkr.ecr.us-west-2.amazonaws.com/pytorch-inference:2.5.1-gpu-py311-cu124-ubuntu22.04-sagemaker I am trying to use SAM2 model by Meta the numpy version seems to be correct : Requirement already satisfied: numpy>=1.24.4 in /opt/conda/lib/python3.11/site-packages

When I try to predict I am getting this error:

2024-11-14T22:56:39,132 [INFO ] W-9000-model_1.0-stdout MODEL_LOG - Transform failed for model: model. Error traceback: ['Traceback (most recent call last):', ' File "/opt/conda/lib/python3.11/site-packages/sagemaker_inference/transformer.py", line 150, in transform', ' result = self._run_handler_function(', ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^', ' File "/opt/conda/lib/python3.11/site-packages/sagemaker_inference/transformer.py", line 284, in _run_handler_function', ' result = func(argv_context)', ' ^^^^^^^^^^^^^^^^^^^', ' File "/opt/conda/lib/python3.11/site-packages/sagemaker_inference/transformer.py", line 267, in _default_transform_fn', ' data = self._run_handler_function(self._input_fn, (input_data, content_type))', ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^', ' File "/opt/conda/lib/python3.11/site-packages/sagemaker_inference/transformer.py", line 280, in run_handler_function', ' result = func(*argv)', ' ^^^^^^^^^^^', ' File "/opt/conda/lib/python3.11/site-packages/sagemaker_pytorch_serving_container/default_pytorch_inference_handler.py", line 98, in default_input_fn', ' tensor = torch.FloatTensor(', ' ^^^^^^^^^^^^^^^^^^', "TypeError: can't convert np.ndarray of type numpy.object. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint64, uint32, uint16, uint8, and bool."]