我正在尝试按照步骤获取一个简单的 Azure ML 管道,其中包含狗与猫数据集 -在此处记录
我的笔记本包含以下内容 -
import azureml.core
from azureml.core import Workspace, Datastore
from azureml.core import Environment
from azureml.core.environment import CondaDependencies
from azureml.pipeline.steps import PythonScriptStep
ws = Workspace.from_config()
myenv = Environment(name="myenv")
conda_dep = CondaDependencies()
conda_dep.add_conda_package("keras")
conda_dep.add_conda_package("PIL")
myenv.python.conda_dependencies=conda_dep
myenv.register(workspace=ws)
在设置了数据引用和计算之后,这就是我创建管道的方式 -
trainStep = PythonScriptStep(
script_name="dogs_vs_cats.py",
arguments=["--input", blob_input_data, "--output", output_data1],
inputs=[blob_input_data],
outputs=[output_data1],
compute_target=compute_target,
source_directory="../dogs-vs-cats"
)
Steps = [trainStep]
from azureml.pipeline.core import Pipeline
pipeline1 = Pipeline(workspace=ws, steps=[Steps])
from azureml.core import Experiment
pipeline_run1 = Experiment(ws, 'dogs_vs_cats_exp').submit(pipeline1)
pipeline_run1.wait_for_completion()
执行此步骤后,实验失败,在一堆信息后出现以下错误 -
Traceback (most recent call last):
File "dogs_vs_cats.py", line 30, in <module>
import keras
ModuleNotFoundError: No module named 'keras'
终端显示我的 conda 环境设置为 azureml_py36,并且 Keras 似乎列在conda list
.
我是否正确设置了环境?缺少什么