aws / aws/sagemaker-python-sdk

Sagemaker local client invoke_endpoint returns different response than non local counterpart

Đang mở
#3,348 0 bình luận 0 reaction 1 người được giao Được @nargokul nhận Xem trên GitHub
component: local mode 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ả

Sagemaker local client invoke_endpoint method returns a different response than using the boto3 runtime_client, so it makes debugging difficult in local mode, because the same code wouldn't work in production. The missing part is the ResponseMetadata key in the payload
it just returns Body and ContentType
I would want to access ResponseMetadata, InvokedProductionVariant and other related metadata in local mode

**To reproduce**
1. Have a local container running the sagemaker model
2. Invoke the endpoint with sagemaker local client
```python
sagemaker_session = LocalSession()
sagemaker_session.config = {"local": {"local_code": True}}
sm_client = sagemaker_session.sagemaker_runtime_client
response = sm_client.invoke_endpoint(
EndpointName="local-endpoint-name",
ContentType="application/json",
Body=json.dumps(payload),
)
response["ResponseMetadata"]["HTTPStatusCode"] <- Fails
```

**Expected behavior**
the local client should return the same response as the non-local client
local client
```json
{"Body": "foo", "ContentType": "bar"}
```
non-local client
```json
{"Body": "foo", "ContentType": "bar", "ResponseMetadata": {"foo": "bar"}}
```

**System information**
A description of your system. Please provide:
- **SageMaker Python SDK version**: 2.108.0
- **Python version**: 3.7.10
- **CPU or GPU**: CPU
- **Custom Docker image (Y/N)**: Y

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.