I have a directory of:
/ml_engine
setup.py
/trainer
__init__.py
task.py
model.py
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)"
Does ml-engine with alpha commands support this kind of operation?
您需要运行python setup.py --sdist
,然后将dist/trainer.tgz
上传到GCS并将其用作--package-uris
。
I using sklearn_crfsuite estimator
crf = sklearn_crfsuite.CRF(
algorithm='lbfgs',
c1=0.1,
c2=0.1,
max_iterations=2,
all_possible_transitions=True
)
I'm saving the model as described below:
model = 'model.joblib'
joblib.dump(crf, model)
and when I try to deploy the model it reports this error:
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.joblib. No module named sklearn_crfsuite.estimator. (Error code: 0)"
deploy model: gcloud alpha ml-engine versions create v1 --model teste --origin $ORI --python-version 2.7 --runtime-version 1.8 --framework scikit-learn
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.