1 回答
- 最新
- 投票最多
- 评论最多
0
Additionally to AWS CLI, you can pass CustomAttributes
parameter during invocation of endpoint with boto3-client or SM SDK:
- In case of boto3:
runtime_client.invoke_endpoint(CustomAttributes=json.dumps({key1:val1, key2:val2, ...}))
- In case of SM SDK:
predictor.predict(payload, initial_args={'CustomAttributes': json.dumps({key1:val1, key2:val2, ...})})
And then you could parse the context
-arg in the input-handlers of preprocessing.py
, as for example:
def handler(data, context):
processed_input = _process_input(data, context)
custom_attrs = json.loads(context.custom_attributes)
# logic to parse / enact custom attrs ...
response = requests.post(context.rest_uri, data=processed_input)
return _process_output(response, context)
See also this post: https://aws.amazon.com/blogs/machine-learning/amazon-sagemaker-runtime-now-supports-the-customattribute-header/
已回答 2 年前
相关内容
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前