无法在AWS Sagemaker上部署本地训练的逻辑回归模型



我在本地机器上训练了一个逻辑回归模型。使用Joblib保存模型,并尝试使用";线性学习者";形象

在部署过程中面临问题,因为部署过程一直在继续;创建";并且不转向"0";InService";。

endpoint_name = "DEMO-LogisticEndpoint" + strftime("%Y-%m-%d-%H-%M-%S", gmtime())
print(endpoint_name)
create_endpoint_response = sm_client.create_endpoint(
EndpointName=endpoint_name, EndpointConfigName=endpoint_config_name
)
print(create_endpoint_response["EndpointArn"])
resp = sm_client.describe_endpoint(EndpointName=endpoint_name)
status = resp["EndpointStatus"]
print("Status: " + status)
while status == "Creating":
time.sleep(60)
resp = sm_client.describe_endpoint(EndpointName=endpoint_name)
status = resp["EndpointStatus"]
print("Status: " + status)

while循环一直在执行,状态永远不会改变。

背景:重要的是要理解端点运行的容器包括服务软件。每个容器都需要一种特定类型的模型。你需要确保你是模型,以及你如何包装它符合容器的期望。

两条简单的前进道路:

  1. 线性学习器是SageMaker内置的算法,因此直接的方法是在云中训练它。请参阅示例,使其易于部署
  2. 使用Scikit learn Logistic Regression]2,您可以在本地对其进行培训,并使用Scikit learn容器将其部署到SageMaker(XGBoost是另一条简单的路径(

否则,您总是可以更先进地使用任何自定义算法,方法是通过自带容器来自带自定义算法/框架。谷歌现有的实现(例如CatBoost/SageMaker(。

最新更新