簡體   English   中英

ml-engine-沒有名為Trainer的模塊

[英]ml-engine - no module named trainer

我有一個目錄:

/ml_engine
  setup.py
  /trainer
    __init__.py
    task.py
    model.py

我有一個與sklearn mixins一起使用的自定義模型,該模型允許我將該模型用作sklearn模型。

但是,當我嘗試上傳模型時,會出現錯誤:

gcloud alpha ml-engine versions create m_0_03 \
--model model_9281830085_204245556_prophet \
--origin gs://BUCKET/9281830085_204245556/2018-08-23T13:37:00.000218 \
--runtime-version=1.9 \
--framework SCIKIT_LEARN \
--python-version=3.5 \
--package-uris=["gs://BUCKET/model_packages/trainer/"] \
--model-class=trainer.model \

Creating version (this might take a few minutes)......
...................................................................................................failed.
ERROR: (gcloud.alpha.ml-engine.versions.create) Bad model detected with error:  "Failed to load model: Could not load the model: /tmp/model/0001/model.pkl. No module named 'trainer'. (Error code: 0)"

帶alpha命令的ml-engine是否支持這種操作?

您需要運行python setup.py --sdist ,然后將dist/trainer.tgz上傳到GCS並將其用作--package-uris

我使用sklearn_crfsuite估算器

crf = sklearn_crfsuite.CRF(

    algorithm='lbfgs',
    c1=0.1,
    c2=0.1,
    max_iterations=2,
    all_possible_transitions=True
)

我將按照以下說明保存模型:

model = 'model.joblib'

joblib.dump(crf, model)

當我嘗試部署模型時,它報告此錯誤:

錯誤:(gcloud.alpha.ml-engine.versions.create)檢測到錯誤的模型,並顯示錯誤:“無法加載模型:無法加載模型:/tmp/model/0001/model.joblib。沒有名為sklearn_crfsuite.estimator的模塊。(錯誤代碼:0)”

部署模型:gcloud alpha ml-engine版本創建v1 --model teste --origin $ ORI --python-version 2.7 --runtime-version 1.8 --framework scikit-learn

暫無
暫無

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

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