使用 VS Code 扩展(预览版)管理 Azure 机器学习资源Manage Azure Machine Learning resources with the VS Code Extension (preview)

了解如何使用 VS Code 扩展管理 Azure 机器学习资源。Learn how to manage Azure Machine Learning resources with the VS Code extension.

Azure 机器学习 VS Code 扩展

先决条件Prerequisites

以下所有过程都假设你所在位置为 Visual Studio Code 的“Azure 机器学习”视图。All of the processes below assume that you are in the Azure Machine Learning view in Visual Studio Code. 若要启动扩展,请在 VS Code 活动栏上选择 Azure 图标。To launch the extension, select the Azure icon in the VS Code activity bar.

工作区Workspaces

有关详细信息,请参阅工作区For more information, see workspaces.

创建工作区Create a workspace

  1. 在“Azure 机器学习”视图中,右键单击你的订阅节点,然后选择“创建工作区”。In the Azure Machine Learning view, right-click your subscription node and select Create workspace .
  2. 在提示中执行以下操作:In the prompt:
    1. 为你的工作区提供一个名称Provide a name for your workspace
    2. 选择自己的 Azure 订阅Choose your Azure subscription
    3. 选择或创建要在其中预配工作区的新资源组Choose or create a new resource group to provision the workspace in
    4. 选择要在其中预配工作区的位置。Select the location where to provision the workspace.

用于创建工作区的其他方法包括:Alternative methods to create a workspace include:

  • 打开命令面板“视图”>“命令面板”,进入文本提示“Azure ML:创建工作区”。Open the command palette View > Command Palette and enter into the text prompt Azure ML: Create Workspace .
  • 单击“Azure 机器学习”视图顶部的 + 图标。Click the + icon at the top of the Azure Machine Learning view.
  • 在预配其他资源的过程中,当系统提示你选择工作区时创建新的工作区。Create a new workspace when prompted to select a workspace during the provisioning of other resources.

删除工作区Remove a workspace

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 右键单击要删除的工作区。Right-click the workspace you want to remove.
  3. 选择是否要进行以下删除:Select whether you want to remove:
    • 仅工作区:此选项仅删除工作区 Azure 资源。Only the workspace : This option deletes only the workspace Azure resource. 工作区所附加到的资源组、存储帐户和任何其他资源仍在 Azure 中。The resource group, storage accounts, and any other resources the workspace was attached to are still in Azure.
    • 包括关联的资源:此选项会删除工作区以及与其关联的所有资源。With associated resources : This option deletes the workspace and all resources associated with it.

数据存储Datastores

VS Code 扩展目前支持以下类型的数据存储:The VS Code extension currently supports datastores of the following types:

  • Azure 文件共享Azure File Share
  • Azure Blob 存储Azure Blob Storage

创建工作区时,将为这些类型中的每一个创建一个数据存储。When you create a workspace, a datastore is created for each of these types.

有关详细信息,请参阅数据存储For more information, see datastores.

创建数据存储Create a datastore

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开要在其下创建数据存储的工作区节点。Expand the workspace node you want to create the datastore under.
  3. 右键单击“数据存储”节点,然后选择“注册数据存储”。Right-click the Datastores node and select Register datastore .
  4. 在提示中执行以下操作:In the prompt:
    1. 为你的数据存储提供一个名称。Provide a name for your datastore.
    2. 选择数据存储类型。Choose the datastore type.
    3. 选择你的存储资源。Select your storage resource. 可以选择与工作区关联的存储资源,也可以从 Azure 订阅的任何有效存储资源中进行选择。You can either choose a storage resource that's associated with your workspace or select from any valid storage resource in your Azure subscriptions.
    4. 在前面所选的存储资源中选择你的数据所在的容器。Choose the container where your data is inside the previously selected storage resource.
  5. VS Code 中会出现一个配置文件。A configuration file appears in VS Code. 如果对配置文件满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration file, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

管理数据存储Manage a datastore

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 在工作区中展开“数据存储”节点。Expand the Datastores node inside your workspace.
  4. 选择要对其执行以下操作的数据存储:Select the datastore you want to:
    • 设置为默认值。Set as default . 这是每次运行试验时将使用的数据存储。Whenever you run experiments, this is the datastore that will be used.
    • 检查只读设置。Inspect read-only settings .
    • 修改。Modify . 更改身份验证类型和凭据。Change the authentication type and credentials. 支持的身份验证类型包括帐户密钥和 SAS 令牌。Supported authentication types include account key and SAS token.

数据集Datasets

该扩展当前支持以下数据集类型:The extension currently supports the following dataset types:

  • 表格:允许将数据具体化为数据帧(Pandas 或 PySpark)。Tabular : Allows you to materialize data into a DataFrame (Pandas or PySpark).
  • 文件 :文件或文件集合。File : A file or collection of files. 允许你将文件下载或装载到计算机。Allows you to download or mount files to your compute.

有关详细信息,请参阅数据集For more information, see datasets

创建数据集Create dataset

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开要在其下创建数据存储的工作区节点。Expand the workspace node you want to create the datastore under.
  3. 右键单击“数据集”节点,然后选择“创建数据集”。Right-click the Datasets node and select Create dataset .
  4. 在提示中执行以下操作:In the prompt:
    1. 选择数据集类型Choose the dataset type
    2. 定义数据位置:数据位于电脑上还是 Web 上Define whether the data is located on your PC or on the web
    3. 提供你的数据的位置。Provide the location of your data. 这可以是单个文件,也可以是包含数据文件的目录。This can either be a single file or a directory containing your data files.
    4. 选择要将数据上传到其中的数据存储。Choose the datastore you want to upload your data to.
    5. 提供有助于在数据存储中识别你的数据集的前缀。Provide a prefix that helps identify your dataset in the datastore.

对数据集进行版本控制Version datasets

构建机器学习模型时,可能需要根据数据变化对数据集进行版本控制。When building machine learning models, as data changes, you may want to version your dataset. 若要在 VS Code 扩展中执行此操作,请完成以下步骤:To do so in the VS Code extension:

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 展开“数据集”节点。Expand the Datasets node.
  4. 右键单击要进行版本控制的数据集,然后选择“创建新版本”。Right-click the dataset you want to version and select Create New Version .
  5. 在提示中执行以下操作:In the prompt:
    1. 选择数据集类型Select the dataset type
    2. 定义数据位置:将数据置于电脑上还是 Web 上。Define whether the data is located on your PC or on the web.
    3. 提供你的数据的位置。Provide the location of your data. 这可以是单个文件,也可以是包含数据文件的目录。This can either be a single file or a directory containing your data files.
    4. 选择要将数据上传到其中的数据存储。Choose the datastore you want to upload your data to.
    5. 提供有助于在数据存储中识别你的数据集的前缀。Provide a prefix that helps identify your dataset in the datastore.

查看数据集属性View dataset properties

使用此选项可以查看与特定数据集关联的元数据。This option allows you to see metadata associated with a specific dataset. 若要在 VS Code 扩展中执行此操作,请完成以下步骤:To do so in the VS Code extension:

  1. 展开你的工作区节点。Expand your workspace node.
  2. 展开“数据集”节点。Expand the Datasets node.
  3. 右键单击要检查的数据集,然后选择“查看数据集属性”。Right-click the dataset you want to inspect and select View Dataset Properties . 这会显示一个配置文件,其中包含最新的数据集版本的属性。This will display a configuration file with the properties of the latest dataset version.

备注

如果你有数据集的多个版本,可以选择仅查看特定版本的数据集属性,方法是:展开该数据集节点,然后在感兴趣的版本上执行本部分所述的步骤。If you have multiple version of your dataset, you can choose to only view the dataset properties of a specific version by expanding the dataset node and performing the same steps described in this section on the version of interest.

注销数据集Unregister datasets

若要删除某个数据集及其所有版本,请将其注销。To remove a dataset and all version of it, unregister it. 若要在 VS Code 扩展中执行此操作,请完成以下步骤:To do so in the VS Code extension:

  1. 展开你的工作区节点。Expand your workspace node.
  2. 展开“数据集”节点。Expand the Datasets node.
  3. 右键单击要注销的数据集,然后选择“注销数据集”。Right-click the dataset you want to unregister and select Unregister dataset .

环境Environments

有关详细信息,请参阅环境For more information, see environments.

创建环境Create environment

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开要在其下创建数据存储的工作区节点。Expand the workspace node you want to create the datastore under.
  3. 右键单击“环境”节点,然后选择“创建环境”。Right-click the Environments node and select Create Environment .
  4. 在提示中执行以下操作:In the prompt:
    1. 为你的环境提供一个名称Provide a name for your environment
    2. 定义你的环境配置:Define your environment configuration:
      • 特选的环境:Azure 机器学习中的预配置环境。Curated environments : Preconfigured environments in Azure Machine Learning. 可以通过修改 JSON 文件中的 dependencies 属性来进一步自定义环境。You can further customize the environment by modifying the dependencies property in the JSON file. 详细了解特选的环境Learn more about curated environments.
      • Conda 依赖项文件:对于 Anaconda 环境,可以提供包含环境定义的文件。Conda dependencies file : For Anaconda environments, the file containing your environment definition can be provided.
      • Pip 要求文件:对于 pip 环境,可以提供包含环境定义的文件。Pip requirements file : For pip environments, the file containing your environment definition can be provided.
      • 现有的 Conda 环境:此选项会查找本地电脑中的 conda 环境,并尝试基于所选环境来构建环境。Existing Conda environment : This option looks for the conda environments in your local PC and tries to build an environment from the selected environment.
      • 自定义 :定义你自己的通道和依赖项Custom : Define your own channels and dependencies
    3. 此时会在编辑器中打开一个配置文件。A configuration file opens in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

查看环境配置View environment configurations

若要在扩展中查看特定环境的依赖项和配置,请执行以下操作:To view the dependencies and configurations for a specific environment in the extension:

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 展开“环境”节点。Expand the Environments node.
  4. 右键单击要查看的环境,并选择“查看环境”。Right-click the environment you want to view and select View Environment .

编辑环境配置Edit environment configurations

若要在扩展中编辑特定环境的依赖项和配置,请执行以下操作:To edit the dependencies and configurations for a specific environment in the extension:

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“环境”节点。Expand the Environments node inside your workspace.
  3. 右键单击要查看的环境,并选择“编辑环境”。Right-click the environment you want to view and select Edit Environment .
  4. 进行修改之后,如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。After making the modifications, if you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

试验Experiments

有关详细信息,请参阅试验For more information, see experiments.

创建试验Create experiment

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 右键单击工作区中的“试验”节点,然后选择“创建试验”。 Right-click the Experiments node in your workspace and select Create experiment .
  4. 在提示中,为你的试验提供一个名称。In the prompt, provide a name for your experiment.

运行试验Run experiment

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“试验”节点。Expand the Experiments node inside your workspace.
  3. 右键单击要运行的试验。Right-click the experiment you want to run.
  4. 选择活动栏中的“运行试验”图标。Select the Run Experiment icon in the activity bar.
  5. 选择订阅。Choose your subscription.
  6. 选择要在其下运行试验的 Azure ML 工作区。Choose the Azure ML Workspace to run the experiment under.
  7. 选择你的试验。Choose your experiment.
  8. 选择或创建要在其上运行试验的计算。Choose or create a compute to run the experiment on.
  9. 为试验选择或创建运行配置。Choose or create a run configuration for your experiment.

也可选择扩展顶部的“运行试验”按钮,然后在提示中配置试验运行。Alternatively, you can select the Run Experiment button at the top of the extension and configure your experiment run in the prompt.

查看试验View experiment

若要在 Azure 机器学习工作室中查看试验,请执行以下操作:To view your experiment in Azure Machine Learning Studio:

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“试验”节点。Expand the Experiments node inside your workspace.
  3. 右键单击要查看的试验,并选择“查看试验”。Right-click the experiment you want to view and select View Experiment .
  4. 此时会出现一个提示,要求你在 Azure 机器学习工作室中打开试验 URL。A prompt appears asking you to open the experiment URL in Azure Machine Learning studio. 选择“打开” 。Select Open .

跟踪运行进度Track run progress

运行试验时,你可能希望查看其进度。As you're running your experiment, you may want to see its progress. 若要从扩展中跟踪 Azure 机器学习工作室中某个运行的进度,请执行以下操作:To track the progress of a run in Azure Machine Learning studio from the extension:

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“试验”节点。Expand the Experiments node inside your workspace.
  3. 展开要跟踪其进度的试验节点。Expand the experiment node you want to track progress for.
  4. 右键单击该运行,然后选择“在 Azure 门户中查看运行”。Right-click the run and select View Run in Azure portal .
  5. 此时会出现一个提示,要求你在 Azure 机器学习工作室中打开运行 URL。A prompt appears asking you to open the run URL in Azure Machine Learning studio. 选择“打开” 。Select Open .

下载运行日志和输出Download run logs & outputs

某个运行完成后,你可能希望下载日志和资产,例如在试验运行过程中生成的模型。Once a run is complete, you may want to download the logs and assets such as the model generated as part of an experiment run.

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“试验”节点。Expand the Experiments node inside your workspace.
  3. 展开要跟踪其进度的试验节点。Expand the experiment node you want to track progress for.
  4. 右键单击该运行:Right-click the run:
    • 若要下载输出,请选择“下载输出”。To download the outputs, select Download outputs .
    • 若要下载日志,请选择“下载日志”。To download the logs, select Download logs .

查看运行元数据View run metadata

在扩展中,可以检查元数据,例如用于运行的运行配置以及运行详细信息。In the extension, you can inspect metadata such as the run configuration used for the run as well as run details.

计算实例Compute instances

有关详细信息,请参阅计算实例For more information, see compute instances.

创建计算实例Create compute instance

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开要在其下创建计算实例的工作区节点。Expand the workspace node you want to create the compute instance under.
  3. 右键单击“计算实例”节点,然后选择“创建计算实例” 。Right-click the Compute instances node and select Create compute instance .
  4. 在提示中执行以下操作:In the prompt:
    1. 为计算实例提供一个名称。Provide a name for your compute instance.
    2. 从列表中选择 VM 大小。Select a VM size from the list.
    3. 选择是否要启用 SSH 访问。Choose whether you want to enable SSH access.
      1. 如果启用 SSH 访问,还必须提供公共 SSH 密钥或包含密钥的文件。If you enable SSH access, you'll have to also provide the public SSH key or the file containing the key. 有关详细信息,请参阅在 Azure 上创建和使用 SSH 密钥的指南For more information, see the guide on creating and using SSH keys on Azure.

停止或重启计算实例Stop or restart compute instance

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算实例”节点。Expand the Compute instance node inside your workspace.
  3. 右键单击要停止或重启的计算实例,分别选择“停止计算实例”或“重启计算实例”。Right-click the compute instance you want to stop or restart and select Stop Compute instance or Restart compute instance respectively.

查看计算实例配置View compute instance configuration

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算实例”节点。Expand the Compute instance node inside your workspace.
  3. 右键单击要检查的计算实例,然后选择“查看计算实例属性”。Right-click the compute instance you want to inspect and select View Compute instance Properties .

删除计算实例Delete compute instance

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算实例”节点。Expand the Compute instance node inside your workspace.
  3. 右键单击要删除的计算实例,然后选择“删除计算实例”。Right-click the compute instance you want to delete and select Delete compute instance .

计算群集Compute clusters

此插件支持以下计算类型:The extension supports the following compute types:

  • Azure 机器学习计算群集Azure Machine Learning compute cluster
  • Azure Kubernetes 服务Azure Kubernetes Service

有关详细信息,请参阅计算目标For more information, see compute targets.

创建计算Create compute

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开要在其下创建计算群集的工作区节点。Expand the workspace node you want to create the compute cluster under.
  3. 右键单击“计算群集”节点,然后选择“创建计算” 。Right-click the Compute clusters node and select Create Compute .
  4. 在提示中执行以下操作:In the prompt:
    1. 选择计算类型Choose a compute type
    2. 选择 VM 大小。Choose a VM size. 详细了解 VM 大小Learn more about VM sizes.
    3. 为你的计算提供一个名称。Provide a name for your compute.

查看计算配置View compute configuration

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算群集”节点。Expand the Compute clusters node inside your workspace.
  3. 右键单击要查看的计算,然后选择“查看计算属性”。Right-click the compute you want to view and select View Compute Properties .

编辑计算缩放设置Edit compute scale settings

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算群集”节点。Expand the Compute clusters node inside your workspace.
  3. 右键单击要编辑的计算,然后选择“编辑计算”。Right-click the compute you want to edit and select Edit Compute .
  4. 此时会在编辑器中打开一个用于计算的配置文件。A configuration file for your compute opens in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

删除计算Delete compute

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算群集”节点。Expand the Compute clusters node inside your workspace.
  3. 右键单击要删除的计算,然后选择“删除计算”。Right-click the compute you want to delete and select Delete Compute .

创建运行配置Create run configuration

若要在扩展中创建运行配置,请执行以下操作:To create a run configuration in the extension:

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“计算群集”节点。Expand the Compute clusters node inside your workspace.
  3. 右键单击要在其下创建运行配置的计算目标,然后选择“创建运行配置”。Right-click the compute target you want create the run configuration under and select Create Run Configuration .
  4. 在提示中执行以下操作:In the prompt:
    1. 为你的计算目标提供一个名称Provide a name for your compute target
    2. 选择或创建一个新环境。Choose or create a new environment.
    3. 键入要运行的脚本的名称,或按 Enter 以在本地计算机上浏览查找该脚本。Type the name of the script you want to run or press Enter to browser for the script on your local computer.
    4. (可选)选择是否要为训练运行创建数据参考。(Optional) Chose whether you want to create a data reference for your training run. 如果你这样做,系统会提示你在运行配置中定义一个数据集。Doing so will prompt you to define a dataset in your run configuration.
      1. 选择你注册的数据集之一以链接到运行配置,此时会在编辑器中打开数据集的配置文件。Select from one of your registered datasets to link to the run configuration A configuration file for your dataset opens in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .
    5. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

编辑运行配置Edit run configuration

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区的“计算群集”节点中展开你的计算群集节点。Expand your compute cluster node in the Compute clusters node of your workspace.
  3. 右键单击要编辑的运行配置,然后选择“编辑运行配置”。Right-click the run configuration you want to edit and select Edit Run Configuration .
  4. 此时会在编辑器中打开一个用于你的运行配置的配置文件。A configuration file for your run configuration opens in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

删除运行配置Delete run configuration

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 在“计算群集”节点中展开感兴趣的计算群集节点。Expand the compute cluster node of interest inside the Compute clusters node.
  4. 右键单击要编辑的运行配置,然后选择“删除运行配置”。Right-click the run configuration you want to edit and select Delete Run Configuration .

模型Models

有关详细信息,请参阅模型For more information, see models

注册模型Register model

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 右键单击“模型”节点,然后选择“注册模型”。Right-click the Models node and select Register Model .
  4. 在提示中执行以下操作:In the prompt:
    1. 为你的模型提供一个名称Provide a name for your model
    2. 选择你的模型是文件还是文件夹。Choose whether your model is a file or folder.
    3. 在本地电脑中找到该模型。Find the model in your local PC.
    4. 编辑器中的模型配置文件。A configuration file for your model in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

查看模型属性View model properties

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“模型”节点。Expand the Models node inside your workspace.
  3. 右键单击要查看其属性的模型,然后选择“查看模型属性”。Right-click the model whose properties you want to see and select View Model Properties . 此时会在编辑器中打开一个文件,其中包含你的模型属性。A file opens in the editor containing your model properties.

下载模型Download model

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“模型”节点。Expand the Models node inside your workspace.
  3. 右键单击要下载的模型,然后选择“下载模型文件”。Right-click the model you want to download and select Download Model File .

删除模型Delete a model

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“模型”节点。Expand the Models node inside your workspace.
  3. 右键单击要删除的模型,然后选择“删除模型”。Right-click the model you want to delete and select Remove Model .

终结点Endpoints

VS Code 扩展支持以下部署目标:The VS Code extension supports the following deployment targets:

  • Azure 容器实例Azure Container Instances
  • Azure Kubernetes 服务Azure Kubernetes Service

有关详细信息,请参阅 Web 服务终结点For more information, see web service endpoints.

创建部署Create deployments

备注

创建部署的操作目前仅适用于 Conda 环境。Deployment creation currently only works with Conda environments.

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 展开你的工作区节点。Expand your workspace node.
  3. 右键单击“终结点”节点并选择“部署服务”。Right-click the Endpoints node and select Deploy Service .
  4. 在提示中执行以下操作:In the prompt:
    1. 选择是要使用已注册的模型还是使用本地模型文件。Choose whether you want to use an already registered model or a local model file.
    2. 选择你的模型Select your model
    3. 选择要将你的模型部署到的部署目标。Choose the deployment target you want to deploy your model to.
    4. 为你的模型提供一个名称。Provide a name for your model.
    5. 提供对模型进行评分时要运行的脚本。Provide the script to run when scoring the model.
    6. 提供 Conda 依赖项文件。Provide a Conda dependencies file.
    7. 此时会在编辑器中显示你的部署的配置文件。A configuration file for your deployment appears in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .

备注

也可在“模型”节点中右键单击已注册的模型,然后选择“从已注册的模型部署服务”。Alternatively, you can right-click a registered model in the Models node and select Deploy Service From Registered Model .

删除部署Delete deployments

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“终结点”节点。Expand the Endpoints node inside your workspace.
  3. 右键单击要删除的部署,然后选择“删除服务”。Right-click the deployment you want to remove and select Remove service .
  4. 此时会出现一个提示,要求你确认是否要删除该服务。A prompt appears confirming you want to remove the service. 选择“确定”。Select Ok .

管理部署Manage deployments

除了创建和删除部署之外,还可以查看和编辑与部署关联的设置。In addition to creating and deleting deployments, you can view and edit settings associated with the deployment.

  1. 展开包含你的工作区的订阅节点。Expand the subscription node that contains your workspace.
  2. 在工作区中展开“终结点”节点。Expand the Endpoints node inside your workspace.
  3. 右键单击要管理的部署:Right-click the deployment you want to manage:
    • 若要编辑设置,请选择“编辑服务”。To edit settings, select Edit service .
      • 此时会在编辑器中显示你的部署的配置文件。A configuration file for your deployment appears in the editor. 如果对配置满意,请选择“保存并继续”或打开 VS Code 命令面板(“视图”>“命令面板”),然后键入“Azure ML:保存并继续”。If you're satisfied with your configuration, select Save and continue or open the VS Code command palette ( View > Command Palette ) and type Azure ML: Save and Continue .
    • 若要查看部署配置设置,请选择“查看服务属性”。To view deployment configuration settings, select View service properties .

后续步骤Next steps

使用 VS Code 扩展训练图像分类模型Train an image classification model with the VS Code extension.