问题
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
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...
回答1:
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.
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)).
Try using runtime version 2.1 in order to fix your issue.
来源:https://stackoverflow.com/questions/60953785/error-create-version-failed-bad-model-detected-with-error-failed-to-load-mod