共用方式為


Quickstart: Deploy a Python model as a web service with azureml-model-management-sdk

Important

This content is being retired and may not be updated in the future. The support for Machine Learning Server will end on July 1, 2022. For more information, see What's happening to Machine Learning Server?

Applies to: Machine Learning Server 9.x

Learn how to deploy a Python model as a web service with Machine Learning Server. Data scientists work locally in their preferred Python IDE and favorite version control tools to build scripts and models. Using the azureml-model-management-sdk Python package that ships with Machine Learning Server, you can develop, test, and ultimately deploy these Python analytics as web services in your production environment.

In Machine Learning Server, a web service is a model and/or code that has been deployed and hosted in the server. Each web service is uniquely defined by a name and version. When consumed, the service consists of the code execution on a compute node. Learn more about web services.

You can use the functions in the azureml-model-management-sdk Python library to manage the web service's lifecycle from a Python script. A set of RESTful APIs is also available to provide direct programmatic access to a service's lifecycle.

Time estimate

After you have completed the prerequisites, this task takes approximately 10 minutes to complete.

Prerequisites

Before you begin this QuickStart, have the following ready:

Example code

The example for this quickstart is stored in a Jupyter Notebook. This notebook format allows you to not only see the code alongside detailed explanations, but also allows you to try out the code.

This example walks through the deployment of a Python model as a web service hosted in Machine Learning Server. We will build a simple linear model using the rx_lin_mod function from the revoscalepy package installed with Machine Learning Server or locally on Windows machine. This package requires a connection to Machine Learning Server.

The notebook example walks you through how to:

  1. Create and run a linear model locally

  2. Authenticate with Machine Learning Server from your Python script

  3. Publish the model as a Python web service to Machine Learning Server

  4. Examine, test, and consume the service in the same session

  5. Delete the service

You can try it yourself with the notebook.

Download the Jupyter Notebook to try it out.

Next steps

After it has been deployed, the web service can be:

See also

This section provides a quick summary of useful links for data scientists looking to operationalize their analytics with Machine Learning Server.