tob*_*man 2 python azure azure-machine-learning-studio azure-machine-learning-service
背景
我已经从 condaenvironment.yml加上一些 docker 配置和环境变量创建了一个 ML Workspace 环境。我可以从 Python 笔记本中访问它:
env = Environment.get(workspace=ws, name='my-environment', version='1')
Run Code Online (Sandbox Code Playgroud)
我可以成功地使用它来运行 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)
Run Code Online (Sandbox Code Playgroud)
问题
我现在想像流水线一样运行这个相同的脚本,这样我就可以用不同的参数触发多次运行。我创建的管道如下:
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()
Run Code Online (Sandbox Code Playgroud)
当我然后尝试运行管道时:
pipeline_run = Experiment(ws, 'my_pipeline_run').submit(
    pipeline, pipeline_parameters={...}
)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误: 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 依赖项都没有配置,因此代码没有运行。我究竟做错了什么?
你快到了,但你需要使用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)
Run Code Online (Sandbox Code Playgroud)
        |   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           848 次  |  
        
|   最近记录:  |