[英]AWS SageMaker Deployment for Batch Transform
我正在嘗試在 Sage Maker 中使用 XGBoost 模型,並使用它來使用批量轉換對存儲在 S3 中的大型數據進行評分。
我使用現有的 Sagemaker Container 構建模型,如下所示:
estimator = sagemaker.estimator.Estimator(image_name=container,
hyperparameters=hyperparameters,
role=sagemaker.get_execution_role(),
train_instance_count=1,
train_instance_type='ml.m5.2xlarge',
train_volume_size=5, # 5 GB
output_path=output_path,
train_use_spot_instances=True,
train_max_run=300,
train_max_wait=600)
estimator.fit({'train': s3_input_train,'validation': s3_input_test})
下面的代碼是用來做Batch Transform的
The location of the test dataset
batch_input = 's3://{}/{}/test/examples'.format(bucket, prefix)
# The location to store the results of the batch transform job
batch_output = 's3://{}/{}/batch-inference'.format(bucket, prefix)
transformer = xgb_model.transformer(instance_count=1, instance_type='ml.m4.xlarge', output_path=batch_output)
transformer.transform(data=batch_input, data_type='S3Prefix', content_type='text/csv', split_type='Line')
transformer.wait()
當模型在 Jupyter 中構建時,上述代碼在開發環境(Jupyter notebook)中運行良好。 但是,我想部署模型並調用其端點進行批量轉換。
SageMaker 端點創建的大多數示例用於對單個數據進行評分,而不是用於批量轉換。
有人可以指出如何在 SageMaker 中部署和使用批量轉換的端點嗎? 謝謝
以下鏈接有一個示例,說明如何在 SageMaker 中調用存儲模型來運行批量轉換作業。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.