如何在ML Azure管道中使用环境

托比·科尔曼

背景

我已经从condaenvironment.yml以及一些docker config和环境变量创建了ML Workspace环境我可以在Python笔记本中访问它:

env = Environment.get(workspace=ws, name='my-environment', version='1')

我可以成功地使用它来运行Python脚本作为实验,即

runconfig = ScriptRunConfig(source_directory='script/', script='my-script.py', arguments=script_params)
runconfig.run_config.target = compute_target
runconfig.run_config.environment = env
run = exp.submit(runconfig)

问题

我现在想运行与管道相同的脚本,以便可以使用不同的参数触发多次运行。我创建了管道,如下所示:

pipeline_step = PythonScriptStep(
    source_directory='script', script_name='my-script.py',
    arguments=['-a', param1, '-b', param2],
    compute_target=compute_target,
    runconfig=runconfig
)
steps = [pipeline_step]
pipeline = Pipeline(workspace=ws, steps=steps)
pipeline.validate()

然后,当我尝试运行管道时:

pipeline_run = Experiment(ws, 'my_pipeline_run').submit(
    pipeline, pipeline_parameters={...}
)

我收到以下错误: Response status code does not indicate success: 400 (Conda dependencies were not specified. Please make sure that all conda dependencies were specified i).

当我查看在Azure门户中运行的管道时,似乎尚未拾取环境:我的conda依赖项均未配置,因此代码未运行。我究竟做错了什么?

安德斯·斯旺森(Anders Swanson)

您快到了,但是您需要使用RunConfiguration而不是ScriptRunConfig更多信息在这里

from azureml.core.runconfig import RunConfiguration

env = Environment.get(workspace=ws, name='my-environment', version='1')
# create a new runconfig object
runconfig = RunConfiguration()
runconfig.environment = env

pipeline_step = PythonScriptStep(
    source_directory='script', script_name='my-script.py',
    arguments=['-a', param1, '-b', param2],
    compute_target=compute_target,
    runconfig=runconfig
)

pipeline = Pipeline(workspace=ws, steps=[pipeline_step])

pipeline_run = Experiment(ws, 'my_pipeline_run').submit(pipeline)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在 Azure 的 CI/CD 管道中使用环境变量

如何使用自定义环境和管道对Azure ML工作区进行版本控制?

如何在pyspark ml管道中的列子集中使用StandardScaler?

如何在 Azure DevOps 管道中使用复杂变量

如何在Azure Repos和管道中使用Git LFS

如何在 azure 管道中使用 Go Beta/RC 版本

如何在 Azure 管道中使用 npm link 命令

如何在Jenkins声明式管道的agent部分中使用环境变量?

如何在 Spark/Scala ML 中使用 RegexTokenizer() 删除标签?

如何在Vespa.ai中使用ML模型?

Google Cloud:如何在 Cloud Datalab 中使用 Cloud ML

如何在触发的管道中使用以前的Azure DevOps yaml管道名称?

如何在PySpark中使用自定义功能在同一ML管道中传递bucketizer?

如何在 azure devops 管道中使用来自 azure devops 存储库的共享文件

如何在Azure ML管道中正确指定私有ACR Docker映像?

Azure ML:如何在多个实例上训练模型

如何在Azure ML中重用成功构建的Docker映像?

如何在管道中使用猫

如何在dplyr管道中使用stringr

如何在powershell -Command ...中使用管道(|)?

如何在变量引用中使用管道?

如何在管道中使用“ sed”

如何在shell管道中使用`jq`?

如何在ggplot管道中使用子集?

如何在管道中使用 ngModelChange

如何在管道中使用状态?

如何在Dev Ops管道中使用Azure脚本访问Powershell中的变量

如何在 azure 管道模板中使用 powershell/bash 脚本文件

如何在Azure Devops生成管道中使用串联的版本变量替换令牌