aws / aws/sagemaker-python-sdk

Error in using Clarify with AWS Jumpstart image classification models

Đang mở
#4,815 0 bình luận 0 reaction 1 người được giao Được @pintaoz-aws nhận Xem trên GitHub
type: bug
Ngôn ngữ chính
Python
Star
2.3k
Fork
1.3k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
35

Mô tả

**Describe the bug**
In AWS Clarify in `ModelConfig` for images the accepted content type is `image/png` while in the AWS jump start the only accepted content type is `application/x-image` which is not accepted in `ModelConfig` of Clarify.

```python
model_config = clarify.ModelConfig(
model_name=model_name, instance_type="ml.m5.xlarge", instance_count=1, content_type="image/png"
)
```

from `inference.py` in jumpstart:
```python
def input_fn(input_data, content_type):
"""
Args:
input_data: the request payload serialized in the content_type format
content_type: the request content_type
"""
if content_type == "application/x-image":
decoded = Image.open(io.BytesIO(input_data))
else:
raise ValueError(f"Type [{content_type}] not supported.")

preprocess = transforms.Compose([transforms.ToTensor()])
normalized = preprocess(decoded)
return normalized
```

**To reproduce**
1. Train an image classification model using jumpstart
2. Use that model with AWS clarify (to get shap values for example)

**Expected behavior**
I expect it to work

**Screenshots or logs**
An error occurred (ModelError) when calling the InvokeEndpoint operation (reached max retries: 0): Received server error (500) from primary with message "{"error": "unsupported content type image/png"}"

**System information**
A description of your system. Please provide:
- **SageMaker Python SDK version**:
- **Framework name (eg. PyTorch) or algorithm (eg. KMeans)**: tensorflow
- **Framework version**:
- **Python version**: 3.6
- **CPU or GPU**:
- **Custom Docker image (Y/N)**: N

**Additional context**
Add any other context about the problem here.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.