我正在尝试在Azure机器学习工作室中使用Python SDK v2创建一个管道。已经被这个错误卡住了很多..很多..个小时了,所以现在我正在联系。
我一直遵循以下指南:https://learn.microsoft.com/en-us/azure/machine-learning/tutorial-pipeline-python-sdk
我的设置非常相似,但是我将“data_prep”拆分为两个单独的步骤,并且我使用的是自定义ml模型。
如何定义管道:
`
# the dsl decorator tells the sdk that we are defining an Azure ML pipeline
from azure.ai.ml import dsl, Input, Output
import pathlib
import os
@dsl.pipeline(
compute=cpu_compute_target,
description="Car predict pipeline",
)
def car_predict_pipeline(
pipeline_job_data_input,
pipeline_job_registered_model_name,
):
# using data_prep_function like a python call with its own inputs
data_prep_job = data_prep_component(
data=pipeline_job_data_input,
)
print('-----------------------------------------------')
print(os.path.realpath(str(pipeline_job_data_input)))
print(os.path.realpath(str(data_prep_job.outputs.prepared_data)))
print('-----------------------------------------------')
train_test_split_job = traintestsplit_component(
prepared_data=data_prep_job.outputs.prepared_data
)
# using train_func like a python call with its own inputs
train_job = train_component(
train_data=train_test_split_job.outputs.train_data, # note: using outputs from previous step
test_data=train_test_split_job.outputs.test_data, # note: using outputs from previous step
registered_model_name=pipeline_job_registered_model_name,
)
# a pipeline returns a dictionary of outputs
# keys will code for the pipeline output identifier
return {
# "pipeline_job_train_data": train_job.outputs.train_data,
# "pipeline_job_test_data": train_job.outputs.test_data,
"pipeline_job_model": train_job.outputs.model
}
'我设法通过命令行成功地按顺序运行了每个组件,并生成了一个经过训练的模型。因此,组件和数据运行正常,但管道无法运行。
我可以提供额外的信息,但我不确定需要什么,我不想杂乱的职位。
我试过用谷歌搜索。我试过将教程中的管道与我自己的管道进行比较。我试过使用print语句来隔离问题。到目前为止没有任何效果。我所做的任何事情也没有改变错误,无论如何都是同样的错误。
编辑:
关于我的环境的一些其他信息:
from azure.ai.ml.entities import Environment
custom_env_name = "pipeline_test_environment_pricepredict_model"
pipeline_job_env = Environment(
name=custom_env_name,
description="Environment for testing out Jeppes model in pipeline building",
conda_file=os.path.join(dependencies_dir, "conda.yml"),
image="mcr.microsoft.com/azureml/openmpi3.1.2-ubuntu18.04:latest",
version="1.0",
)
pipeline_job_env = ml_client.environments.create_or_update(pipeline_job_env)
print(
f"Environment with name {pipeline_job_env.name} is registered to workspace, the environment version is {pipeline_job_env.version}"
)
Build status of environment. It had already run successfully.
1条答案
按热度按时间6mzjoqzu1#
在Azure机器学习工作室中,当应用程序运行和模型部署时,我们有默认选项来获取策展环境或自定义环境。如果环境是基于现有部署创建的,我们需要检查构建是否成功。
在部署成功之前,我们无法将环境变量记录到程序中,也无法通过代码块检索变量。
选择需要使用的环境。
选择已创建的现有版本。
指令集
如果使用docker和conda环境创建,我们将获得挂载位置的详细信息和docker文件。
环境已成功启动并运行。如果案例正在运行,则可以使用资产ID或装载详细信息检索环境变量信息。
指令集