简体   繁体   English

Google Cloud Platform,ML引擎,没有名为sklearn_crfsuite.estimator的模块

[英]Google Cloud Platform, Ml Engine, No module named sklearn_crfsuite.estimator

I have successfully trained a model scikit on ML Engine. 我已经在ML Engine上成功训练了一个模型scikit。 I can get the model.joblib file from my Cloud Storage bucket and load it, and also get local predictions using gcloud. 我可以从Cloud Storage存储桶中获取model.joblib文件并加载它,还可以使用gcloud获取本地预测。 However I can't create a model version. 但是我无法创建模型版本。

I using sklearn_crfsuite estimator 我使用sklearn_crfsuite估算器

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)

my setup.py to train is: 我的setup.py要训练的是:

'''Cloud ML Engine package configuration.'''
from setuptools import setup, find_packages



REQUIRED_PACKAGES = ['joblib==0.13.0',
                     'sklearn-crfsuite==0.3.6',
                     'sklearn==0.0'
                    ]

setup(name='trainer',
      version='1.0',
      packages=find_packages(),
      include_package_data=True,
      install_requires=REQUIRED_PACKAGES)

I submit package train: 我提交包裹火车:

gcloud ml-engine jobs submit training train_$JOB_NAME \
--runtime-version 1.8 \
--python-version 2.7 \
--job-dir=gs://$BUCKET_NAME/jobs/$JOB_NAME/ \
--package-path= trainer \
--module-name trainer.model \
--region $REGION \
--scale-tier BASIC \
-- \
--train-data-dir=gs://$BUCKET_NAME/dataset \
--job-dir=gs://$BUCKET_NAME/jobs/$JOB_NAME

The model is trained and exported in job-dir, but when to deploy: 该模型经过训练并在job-dir中导出,但是何时部署:

gcloud alpha ml-engine versions create v1 --model teste --origin \
$ORI --python-version 2.7 --runtime-version 1.8 --framework scikit-learn

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)" 错误:(gcloud.alpha.ml-engine.versions.create)检测到错误的模型,并显示错误:“无法加载模型:无法加载模型:/tmp/model/0001/model.joblib。没有名为sklearn_crfsuite.estimator的模块。(错误代码:0)”

Could you verify that you have the directory structure correct? 您可以验证目录结构正确吗?

  • You do not need to include sklearn in your setup.py, since it is provided by the framework. 您无需在您的setup.py中包含sklearn,因为它是框架提供的。 To avoid confusion, please remove it from REQUIRED_PACKAGES. 为避免混淆,请从REQUIRED_PACKAGES中将其删除。

  • You can verify that your setup.py is correct by seeing if moving import joblib to be before the import to sklearn-crfsuite works 您可以通过查看将import joblib移到sklearn-crfsuite之前是否可以运行来验证setup.py是否正确

  • Make sure setup.py is parallel to trainer (ie one directory up from model.py). 确保setup.py与Trainer平行(即model.py上的一个目录)。 See this GitHub repo for an example: 有关示例,请参见此GitHub存储库:

https://github.com/GoogleCloudPlatform/training-data-analyst/tree/master/blogs/sklearn/babyweight https://github.com/GoogleCloudPlatform/training-data-analyst/tree/master/blogs/sklearn/babyweight

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 谷歌云平台,ML引擎,“没有名为absl的模块” - Google Cloud Platform, ML Engine, “No module named absl” Google Cloud Platform ML Engine / AI Platform 上的分布式 Keras Tuner - Distributed Keras Tuner on Google Cloud Platform ML Engine / AI Platform 在ML Engine作业中从培训师那里获取状态(Google Cloud Platform) - Get status from trainer in ML Engine job (Google Cloud Platform) 没有名为training的模块,用于TensorFlow教程的Cloud ML Engine,本地运行 - No module named trainer, Cloud ML Engine for TensorFlow Tutorial, Running Locally 在 Google Cloud Platform 上运行 Flask App(ModuleNotFoundError: No module named 'app') - Run Flask App on the Google Cloud Platform (ModuleNotFoundError: No module named 'app') 使用自定义estimator API包装的tensorflow代码是否在Google Cloud-ml引擎或本地计算机中有效使用gpu? - Do tensorflow code, wrapped in using custom estimator api use gpu efficiently in google cloud-ml engine or in local machine? 如何保存Tensorflow估算器模型以在Google ML Engine上投放 - How to save a Tensorflow estimator model for serving on Google ML Engine ml-engine-没有名为Trainer的模块 - ml-engine - no module named trainer 部署到Google App Engine时“没有名为cloud的模块” - “No module named cloud” while deploying to Google App Engine 带有App Engine的Django上没有名为boto Google Cloud Storage的模块 - No module named boto Google Cloud Storage on Django with App Engine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM