ml-engine-没有名为Trainer的模块 [英] ml-engine - no module named trainer

查看:96
本文介绍了ml-engine-没有名为Trainer的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目录为:

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

我有一个与sklearn mixins一起使用的自定义模型,可让我将该模型用作sklearn模型.

I have a custom model used with sklearn mixins that allows me to use the model as a sklearn model.

但是,当我尝试上传模型时,我会收到错误消息:

However when I try to upload the model I would get the error:

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是否支持这种操作?

Does ml-engine with alpha commands support this kind of operation?

推荐答案

您需要运行python setup.py --sdist,然后将dist/trainer.tgz上传到GCS并将其用作--package-uris.

You need to run python setup.py --sdist and then upload dist/trainer.tgz to GCS and use that as --package-uris.

这篇关于ml-engine-没有名为Trainer的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆