azure机器学习服务-如何使用dsl.pipeline提交本地作业



尝试在本地运行和调试管道。管道用azure.ml.component.dsl.pipeline实现。当我尝试设置default_compute_target='local'时,无法找到计算目标:

local not found in workspace, assume this is an AmlCompute
...
File "/home/amirabdi/miniconda3/envs/stm/lib/python3.8/site-packages/azure/ml/component/run_settings.py", line 596, in _get_compute_type
raise InvalidTargetSpecifiedError(message="Cannot find compute '{}' in workspace.".format(compute_name))
azure.ml.component._util._exceptions.InvalidTargetSpecifiedError: InvalidTargetSpecifiedError:
Message: Cannot find compute 'local' in workspace.
InnerException None
ErrorResponse
{
"error": {
"code": "UserError",
"message": "Cannot find compute 'local' in workspace."
}
}

例如,可以使用azureml.core.ScriptRunConfig实现本地运行。

src = ScriptRunConfig(script="train.py", compute_target="local", environment=myenv)
run = exp.submit(src)

我们有不同类型的计算目标,其中之一是本地计算机。

  1. 创建一个实验

    from azureml.core import Experiment

    experiment_name = 'my_experiment'

    experiment = Experiment(workspace=ws, name=experiment_name)

  2. 选择我们需要运行的计算目标

    compute_target='local'

  3. 如果没有提到compute_target或没有提到ScriptRunConfig,那么AzureML将在本地运行脚本

    from azureml.core import Environment

    myenv = Environment("user-managed-env")

    myenv.python.user_managed_dependencies = True

  4. 根据链接中提到的过程创建脚本作业

  5. 提交实验

run = experiment.submit(config=src)

run.wait_for_completion(show_output=True)

  1. 要检查故障排除程序,请使用链接进行检查

最新更新