Skip to content

Files

Latest commit

 

History

History
129 lines (83 loc) · 6.82 KB

concept-v2.md

File metadata and controls

129 lines (83 loc) · 6.82 KB
title titleSuffix description services ms.service ms.subservice ms.topic ms.author author ms.reviewer ms.date ms.custom
CLI & SDK v2
Azure Machine Learning
This article explains the difference between the v1 and v2 versions of Azure Machine Learning v1 and v2.
machine-learning
machine-learning
core
conceptual
balapv
balapv
sgilley
04/29/2022
cliv2, sdkv2, event-tier1-build-2022

What is Azure Machine Learning CLI & Python SDK v2?

[!INCLUDE dev v2]

Azure Machine Learning CLI v2 and Azure Machine Learning Python SDK v2 (preview) introduce a consistency of features and terminology across the interfaces. In order to create this consistency, the syntax of commands differs, in some cases significantly, from the first versions (v1).

Azure Machine Learning CLI v2

The Azure Machine Learning CLI v2 (CLI v2) is the latest extension for the Azure CLI. The CLI v2 provides commands in the format az ml <noun> <verb> <options> to create and maintain Azure ML assets and workflows. The assets or workflows themselves are defined using a YAML file. The YAML file defines the configuration of the asset or workflow – what is it, where should it run, and so on.

A few examples of CLI v2 commands:

  • az ml job create --file my_job_definition.yaml
  • az ml environment update --name my-env --file my_updated_env_definition.yaml
  • az ml model list
  • az ml compute show --name my_compute

Use cases for CLI v2

The CLI v2 is useful in the following scenarios:

  • On board to Azure ML without the need to learn a specific programming language

    The YAML file defines the configuration of the asset or workflow – what is it, where should it run, and so on. Any custom logic/IP used, say data preparation, model training, model scoring can remain in script files, which are referred to in the YAML, but not part of the YAML itself. Azure ML supports script files in python, R, Java, Julia or C#. All you need to learn is YAML format and command lines to use Azure ML. You can stick with script files of your choice.

  • Ease of deployment and automation

    The use of command-line for execution makes deployment and automation simpler, since workflows can be invoked from any offering/platform, which allows users to call the command line.

  • Managed inference deployments

    Azure ML offers endpoints to streamline model deployments for both real-time and batch inference deployments. This functionality is available only via CLI v2 and SDK v2 (preview).

  • Reusable components in pipelines

    Azure ML introduces components for managing and reusing common logic across pipelines. This functionality is available only via CLI v2 and SDK v2.

Azure Machine Learning Python SDK v2 (preview)

Important

SDK v2 is currently in public preview. The preview version is provided without a service level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Azure ML Python SDK v2 is an updated Python SDK package, which allows users to:

  • Submit training jobs
  • Manage data, models, environments
  • Perform managed inferencing (real time and batch)
  • Stitch together multiple tasks and production workflows using Azure ML pipelines

The SDK v2 is on par with CLI v2 functionality and is consistent in how assets (nouns) and actions (verbs) are used between SDK and CLI. For example, to list an asset, the list action can be used in both CLI and SDK. The same list action can be used to list a compute, model, environment, and so on.

Use cases for SDK v2

The SDK v2 is useful in the following scenarios:

  • Use Python functions to build a single step or a complex workflow

    SDK v2 allows you to build a single command or a chain of commands like python functions - the command has a name, parameters, expects input, and returns output.

  • Move from simple to complex concepts incrementally

    SDK v2 allows you to:

    • Construct a single command.
    • Add a hyperparameter sweep on top of that command,
    • Add the command with various others into a pipeline one after the other.

    This construction is useful, given the iterative nature of machine learning.

  • Reusable components in pipelines

    Azure ML introduces components for managing and reusing common logic across pipelines. This functionality is available only via CLI v2 and SDK v2.

  • Managed inferencing

    Azure ML offers endpoints to streamline model deployments for both real-time and batch inference deployments. This functionality is available only via CLI v2 and SDK v2.

Should I use v1 or v2?

CLI v2

The Azure Machine Learning CLI v1 has been deprecated. We recommend you to use CLI v2 if:

  • You were a CLI v1 user
  • You want to use new features like - reusable components, managed inferencing
  • You don't want to use a Python SDK - CLI v2 allows you to use YAML with scripts in python, R, Java, Julia or C#
  • You were a user of R SDK previously - Azure ML won't support an SDK in R. However, the CLI v2 has support for R scripts.
  • You want to use command line based automation/deployments

SDK v2

The Azure Machine Learning Python SDK v1 doesn't have a planned deprecation date. If you have significant investments in Python SDK v1 and don't need any new features offered by SDK v2, you can continue to use SDK v1. However, you should consider using SDK v2 if:

  • You want to use new features like - reusable components, managed inferencing
  • You're starting a new workflow or pipeline - all new features and future investments will be introduced in v2
  • You want to take advantage of the improved usability of the Python SDK v2 - ability to compose jobs and pipelines using Python functions, easy evolution from simple to complex tasks etc.
  • You don't need features like AutoML in pipelines, Parallel Run Steps, Scheduling Pipelines and Spark Jobs. These features are not yet available in SDK v2.

Next steps