簡體   English   中英

無法在 AWS Sagemaker 上部署本地訓練的邏輯回歸 model

[英]Unable to deploy locally trained Logistic Regression model on AWS Sagemaker

我在我的本地機器上訓練了邏輯回歸 model。 使用 Joblib 保存 model 並嘗試使用“線性學習器”圖像將其部署在 Aws Sagemaker 上。

由於部署過程繼續進行並且狀態始終為“正在創建”並且不會變為“服務中”,因此在部署時面臨問題。

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 循環一直執行,狀態永遠不會改變。

背景:重要的是要了解端點運行一個包含服務軟件的容器。 每個容器都需要某種類型的 model。您需要確保您是 model 以及您的 package 如何與容器的預期相匹配。

兩條簡單的前進道路:

  1. 線性學習器是一種 SageMaker 內置算法,因此直接的路徑是在雲中對其進行訓練。 請參閱示例,使其非常易於部署。
  2. 使用 Scikit-learn Logistic Regression] 2 ,您可以在本地訓練它並使用 scikit-learn 容器XGBoost是另一個簡單的路徑)部署到 SageMaker。

否則,您始終可以 go 更高級,並通過使用自己的容器來使用自己的自定義算法/框架來使用任何自定義算法。 谷歌現有的實現(例如, CatBoost/SageMaker )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM