Azureml SDK v2 提供的资产名称将不用于匿名注册

huangapple go评论99阅读模式
英文:

Azureml SDK v2 The provided asset name will not be used for anonymous registration

问题

以下是翻译好的部分:

我正在尝试使用 AzureML SDK v2 创建一个环境,但出现以下警告/错误:

##[error]警告:提供的资源名称 'my_environment_name' 不会用于匿名注册

这导致我的 Azure DevOps 流水线出现问题,而且我不明白它的含义。

英文:

I am trying to create an environment using AzureML SDK v2 and it throws Warning/Error as follows:

##[error]Warning: the provided asset name 'my_environment_name' will not be used for anonymous registration

This breaks my Azure Devops Pipeline, and also I do not understand the meaning of it.

答案1

得分: 2

以下是翻译好的部分:

TL;DR:
分别注册您的模型和环境


我假设您已经按照如何创建组件管道v2文档中的步骤创建了一个mldesigner.command_component,并通过指定环境参数使用了一个dict对象或Environment对象。

例如:

import mldesigner

environment=dict(
    name="my_env",
    conda_file="conda.yaml",
    image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04",
)

@mldesigner.command_component(
    name="prep_data",
    version="1",
    display_name="Prep Data",
    description="Convert data to CSV file, and split to training and test data",
    environment=environment,
)
def prepare_data_component(
    input_data: Input(type="uri_folder"),
    training_data: Output(type="uri_folder"),
    test_data: Output(type="uri_folder"),
):
    pass

如果您在脚本中运行上述Python代码段,您将收到一个警告:

警告:提供的资源名称 'my_env' 将不会用于匿名注册

这意味着,尽管您指定了名称,但它不会被使用,因为管道命令作业具有匿名环境。
Azure ML环境文档中,我们可以找到:
“匿名”环境在您提交实验时会自动在工作区中注册。它们不会列出,但可以按版本检索。

更精确地说,将创建一个带有GUID的环境CliV2AnonymousEnvironment

尽管在Azure ML管道中使用上述组件不会导致错误,但基于此警告,您的Azure DevOps管道将失败。

解决方案

  1. 分别注册您的模型和环境

建议的解决方案是将您的环境与管道分开管理。因此,通过SDK创建一个环境(管理环境V2文档)并在您的命令组件中指定它:

environment="azureml:my_env@latest"
  1. 将您的环境命名为CliV2AnonymousEnvironment

如果您希望继续使用通过字典对象提供的匿名环境,请将其重命名为CliV2AnonymousEnvironment。使用这个名称不会引发上述错误。

  1. 配置您的Azure DevOps管道,使其不会因此警告而失败

例如(https://stackoverflow.com/questions/64286891/ignore-supress-warning-during-azure-devops-pipeline)


希望这些信息有所帮助,期待您的反馈。我也不认为在Azure ML中如何将所有组件链接在一起很明显。

英文:

TL;DR:
Register your model and environment separately


I assume you followed the how to create component pipeline v2 docs and created a mldesigner.command_component by specifying the environment parameter with a dict object or an Environment object.

E.g.:

import mldesigner

environment=dict(
    name="my_env",
    conda_file="conda.yaml",
    image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04",
)

@mldesigner.command_component(
    name="prep_data",
    version="1",
    display_name="Prep Data",
    description="Convert data to CSV file, and split to training and test data",
    environment=environment,
)
def prepare_data_component(
    input_data: Input(type="uri_folder"),
    training_data: Output(type="uri_folder"),
    test_data: Output(type="uri_folder"),
):
    pass

If you run above Python snippet in a script you will receive a warning:

Warning: the provided asset name 'my_env' will not be used for anonymous registration

This means, although you specify the name it is not used since a pipeline command job has an anonymous environment.
In the Azure ML Environment Docs we find:
"Anonymous" environments are automatically registered in your workspace when you submit an experiment. They will not be listed but may be retrieved by version.

More precisely an environment CliV2AnonymousEnvironment will be created with a GUID.

Using above component in an Azure ML pipeline won't result in an error, though. Of course your Azure DevOps pipeline will fail based on this warning.

Solutions

  1. Register your model and environment separately

The advised solution would be to manage your environment separately of your pipeline. So create an environment via the SDK (Manage Environments V2 Docs) and specify it in your command component:

environment="azureml:my_env@latest"
  1. Name your environment CliV2AnonymousEnvironment

If you would like to keep using an anonymous environment provided via the dictionary object rename it to CliV2AnonymousEnvironment. Using this name won't raise the error from above.

  1. Configure your Azure DevOps pipeline not to fail on this warning

E.g. (https://stackoverflow.com/questions/64286891/ignore-supress-warning-during-azure-devops-pipeline)


I hope this helps, looking forward to feedback. I also do not find it obvious how all the components are linked in Azure ML.

huangapple
  • 本文由 发表于 2023年2月24日 01:03:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75548031.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定