unpickle 自动训练模型时没有名为 'automl' 的模块
No module named 'automl' when unpickle auto-trained model
我正在尝试使用我自己的数据集而不是 MNIST 数据集重现下面的 2 个教程。
https://docs.microsoft.com/ja-jp/azure/machine-learning/service/tutorial-auto-train-models
https://docs.microsoft.com/ja-jp/azure/machine-learning/service/tutorial-deploy-models-with-aml
关于
'/notebooks/tutorials/03.auto-train-models.ipynb'
这里没有问题。我有 'model.pkl'.
然而,
'/notebooks/tutorials/02.deploy-models.ipynb'
'Predict test data' 单元格下方有错误。
我猜这是 'pickle' 和 'import'.
的问题
请告诉我解决方案。
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-11cf888b622f> in <module>
2 from sklearn.externals import joblib
3
----> 4 clf = joblib.load('./model.pkl')
5 # clf = joblib.load('./sklearn_mnist_model.pkl')
6 y_hat = clf.predict(X_test)
~/anaconda3_501/lib/python3.6/site-packages/sklearn/externals/joblib/numpy_pickle.py in load(filename, mmap_mode)
576 return load_compatibility(fobj)
577
--> 578 obj = _unpickle(fobj, filename, mmap_mode)
579
580 return obj
~/anaconda3_501/lib/python3.6/site-packages/sklearn/externals/joblib/numpy_pickle.py in _unpickle(fobj, filename, mmap_mode)
506 obj = None
507 try:
--> 508 obj = unpickler.load()
509 if unpickler.compat_mode:
510 warnings.warn("The file '%s' has been generated with a "
~/anaconda3_501/lib/python3.6/pickle.py in load(self)
1048 raise EOFError
1049 assert isinstance(key, bytes_types)
-> 1050 dispatch[key[0]](self)
1051 except _Stop as stopinst:
1052 return stopinst.value
~/anaconda3_501/lib/python3.6/pickle.py in load_global(self)
1336 module = self.readline()[:-1].decode("utf-8")
1337 name = self.readline()[:-1].decode("utf-8")
-> 1338 klass = self.find_class(module, name)
1339 self.append(klass)
1340 dispatch[GLOBAL[0]] = load_global
~/anaconda3_501/lib/python3.6/pickle.py in find_class(self, module, name)
1386 elif module in _compat_pickle.IMPORT_MAPPING:
1387 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1388 __import__(module, level=0)
1389 if self.proto >= 4:
1390 return _getattribute(sys.modules[module], name)[0]
ModuleNotFoundError: No module named 'automl'
你必须包含 azureml-train-automl 包。你必须这样做:
进口azureml.train.automl
您似乎没有安装 automl
python 软件包。可以通过 import azureml.train.automl
导入它,但您应该真正使用 pip 安装它。
按照 this page 上的指南了解如何为 Azure ML 服务设置 python 环境。
对于大多数用例,notebook
和 automl
是唯一需要的额外包,因此命令
pip install --upgrade azureml-sdk[notebooks,automl]
应该足够了。
使用pip list
查看所有已安装的包和版本号。如果软件包安装正确,您应该会看到 azureml-train-automl
。
我正在尝试使用我自己的数据集而不是 MNIST 数据集重现下面的 2 个教程。 https://docs.microsoft.com/ja-jp/azure/machine-learning/service/tutorial-auto-train-models https://docs.microsoft.com/ja-jp/azure/machine-learning/service/tutorial-deploy-models-with-aml
关于 '/notebooks/tutorials/03.auto-train-models.ipynb' 这里没有问题。我有 'model.pkl'.
然而, '/notebooks/tutorials/02.deploy-models.ipynb' 'Predict test data' 单元格下方有错误。 我猜这是 'pickle' 和 'import'.
的问题请告诉我解决方案。
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-11cf888b622f> in <module>
2 from sklearn.externals import joblib
3
----> 4 clf = joblib.load('./model.pkl')
5 # clf = joblib.load('./sklearn_mnist_model.pkl')
6 y_hat = clf.predict(X_test)
~/anaconda3_501/lib/python3.6/site-packages/sklearn/externals/joblib/numpy_pickle.py in load(filename, mmap_mode)
576 return load_compatibility(fobj)
577
--> 578 obj = _unpickle(fobj, filename, mmap_mode)
579
580 return obj
~/anaconda3_501/lib/python3.6/site-packages/sklearn/externals/joblib/numpy_pickle.py in _unpickle(fobj, filename, mmap_mode)
506 obj = None
507 try:
--> 508 obj = unpickler.load()
509 if unpickler.compat_mode:
510 warnings.warn("The file '%s' has been generated with a "
~/anaconda3_501/lib/python3.6/pickle.py in load(self)
1048 raise EOFError
1049 assert isinstance(key, bytes_types)
-> 1050 dispatch[key[0]](self)
1051 except _Stop as stopinst:
1052 return stopinst.value
~/anaconda3_501/lib/python3.6/pickle.py in load_global(self)
1336 module = self.readline()[:-1].decode("utf-8")
1337 name = self.readline()[:-1].decode("utf-8")
-> 1338 klass = self.find_class(module, name)
1339 self.append(klass)
1340 dispatch[GLOBAL[0]] = load_global
~/anaconda3_501/lib/python3.6/pickle.py in find_class(self, module, name)
1386 elif module in _compat_pickle.IMPORT_MAPPING:
1387 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1388 __import__(module, level=0)
1389 if self.proto >= 4:
1390 return _getattribute(sys.modules[module], name)[0]
ModuleNotFoundError: No module named 'automl'
你必须包含 azureml-train-automl 包。你必须这样做:
进口azureml.train.automl
您似乎没有安装 automl
python 软件包。可以通过 import azureml.train.automl
导入它,但您应该真正使用 pip 安装它。
按照 this page 上的指南了解如何为 Azure ML 服务设置 python 环境。
对于大多数用例,notebook
和 automl
是唯一需要的额外包,因此命令
pip install --upgrade azureml-sdk[notebooks,automl]
应该足够了。
使用pip list
查看所有已安装的包和版本号。如果软件包安装正确,您应该会看到 azureml-train-automl
。