错误:创建版本失败.检测到错误的模型,并显示以下错误:“无法加载模型:无法加载模型 [英] ERROR: Create Version failed. Bad model detected with error: "Failed to load model: Could not load the model

查看:84
本文介绍了错误:创建版本失败.检测到错误的模型,并显示以下错误:“无法加载模型:无法加载模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

clf = svm.SVC()
# Giving test data as input
clf.fit(X_train, y_train)
joblib.dump(clf, 'model.joblib')

GCP_PROJECT = 'career-banao-project'
BUCKET_NAME="career_banao_bucket"
MODEL_BUCKET = 'gs://career_banao_bucket'
VERSION_NAME = 'v1'
MODEL_NAME = 'career_banao_model'

!gsutil mb $MODEL_BUCKET

!gsutil cp ./model.joblib $MODEL_BUCKET

!gcloud ai-platform models create $MODEL_NAME

!gcloud ai-platform versions create $VERSION_NAME \
--model=$MODEL_NAME \
--framework='scikit-learn' \
--runtime-version=1.15 \
--origin=$MODEL_BUCKET \
--python-version=3.7 \
--project=$GCP_PROJECT

创建版本失败.检测到错误的错误模型并显示错误:无法加载模型:无法加载模型:/tmp/model/0001/model.joblib.没有名为'sklearn.svm._classes'的模块.(错误代码:0)" Plz帮助...

Create Version failed. Bad model detected with error: "Failed to load model: Could not load the model: /tmp/model/0001/model.joblib. No module named 'sklearn.svm._classes'. (Error code: 0)" Plz Help...

推荐答案

欢迎使用StackOverflow社区!首先,问题应该始终从上下文开始(解释您尝试在什么地方进行尝试),然后可以包括过程或代码以及特定的错误/日志.这将对您的问题进行很多故障排除.

Welcome to StackOverflow community! First of all, questions should always start with a context (explain what and where you are trying to do it) and then you can include your procedure or code and particular error / logs. This would help a lot troubleshooting your issue.

对于您的错误,运行时 1.15使用scikit-learn 0.20,而模块" _classes"位于0.22中(在0.20中称为""(无下划线).

As for your error, runtime 1.15 uses scikit-learn 0.20, whereas module "_classes" is found in 0.22 (in 0.20 it is called "classes" (no underscore)).

尝试使用运行时版本2.1来解决您的问题.

Try using runtime version 2.1 in order to fix your issue.

这篇关于错误:创建版本失败.检测到错误的模型,并显示以下错误:“无法加载模型:无法加载模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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