我想使用预先构建的scikit学习容器在GCP上部署一个成功的定制培训工作。我使用的模型是一个使用joblib保存的scikit学习RandomForestClassifier。部署失败,原因是
message: "terminate called after throwing an instance of 'std::length_error'"
然而,基于这个问题,我可以通过访问GCSFS进行如下预测:
from io import BytesIO import numpy blob = bucket.blob('titanic/model/model.joblib') model_file = BytesIO() blob.download_to_file(model_file) model = joblib.load(model_file) # Predict with one sample print(model.predict(numpy.array([1,1,24,1,0,211,2,31]).reshape(1,-1)))
它还与gcloud ai-platform local predict --model-dir gs://modeldir \ --json-instances input.json \ --framework scikit-learn
一起运行
如果它在本地成功运行,我不明白为什么它在预测容器中失败。