Azure Machine Learning Notebooks Integration with the Wallaroo SDK
martinbald81
Posted on March 11, 2023
Data Scientists that natively use Azure Machine Learning for model training and development can continue their progress to production ML through deploying models to Wallaroo through the Wallaroo SDK. Through this integration into Azure ML Data scientists can easily upload their models and specify modeling pipelines via the Wallaroo SDK with just a few lines of python, using the notebook environment that they are most comfortable with. This helps to reduce change management overhead for production ML leading to improved scale and repeatable production model operations.
The following guide is created to assist users with installing the Wallaroo SDK, setting up authentication through Azure ML, and making a standard connection to a Wallaroo instance through Azure ML Workspace.
This AzureML Wallaroo SDK Install tutorial is available for download and can be run on the Wallaroo Community Edition.
To learn how to set up the Azure ML environment follow the steps in this guide
Quickstart: Create workspace resources you need to get started with Azure Machine Learning
Steps
Setting Up The Virtual Python Environment.
In the Azure ML window select the Launch Studio button
Next step is to create a workspace.
Inside the workspace select Notebook from the left margin.
Then create a new folder where the Jupyter Notebooks from Wallaroo will be stored.
Once we have the new folder created, open the terminal window as shown below.
With the Terminal window open the next step is to create the Python virtual environment with conda. Replace wallaroosdk with the name of the virtual environment as required by your organization. Note that Python 3.8.6 and above is specified as a requirement for Python libraries used with the Wallaroo SDK. The following will install the latest version of Python 3.8, which as of this time is 3.8.15.
Staying in the terminal window run the following commands to install the SDK
Next step is to activate the environment.
Next Step is to Install the ipykernel library. This allows the JupyterHub notebooks to access the Python virtual environment as a kernel.
Next install the new virtual environment as a python kernel.
Next step is to install the Wallaroo SDK. This process may take several minutes while the other required Python libraries are added to the virtual environment.
Once the conda virtual environment has been installed, it can either be selected as a new Jupyter Notebook kernel, or the Notebook’s kernel can be set to an existing Jupyter notebook. If a notebook is existing, close it then reopen to select the new Wallaroo SDK environment.
To use a new Notebook:
- From the left navigation panel, select +->Notebook.
- From the Kernel selection dropbox on the upper right side, select the new virtual environment - in this case,
wallaroosdk
.
To update an existing Notebook to use the new virtual environment as a kernel:
- From the main menu, select Kernel->Change Kernel.
- Select the new kernel.
With the Wallaroo Python SDK installed, remote commands and inferences can be performed through the following steps.
Open a Connection to Wallaroo through the Wallaroo client.
This is accomplished using the wallaroo.Client(api_endpoint, auth_endpoint, auth_type command) command that connects to the Wallaroo instance services. For more information on the DNS names of Wallaroo services, see the DNS Integration Guide.
The Client method takes the following parameters:
- api_endpoint (String): The URL to the Wallaroo instance API service.
- auth_endpoint (String): The URL to the Wallaroo instance Keycloak service.
- auth_type command (String): The authorization type. In this case, SSO.
Once run, the wallaroo.Client command provides a URL to grant the SDK permission to your specific Wallaroo environment. When displayed, enter the URL into a browser and confirm permissions. Depending on the configuration of the Wallaroo instance, the user will either be presented with a login request to the Wallaroo instance or be authenticated through a broker such as Google, Github, etc.
To use the broker, select it from the list under the username/password login forms. For more information on Wallaroo authentication configurations, see the Wallaroo Authentication Configuration Guides.
Once authenticated, the user will verify adding the device the user is establishing the connection from. Once both steps are complete, then the connection is granted.
The connection is stored in the variable wl for use in all other Wallaroo calls.
And with that the Wallaroo SDK is installed in the Azure ML environment, and now you can continue progress from ML model development through to production and easily upload ML models and specify modeling pipelines via the Wallaroo SDK, with just a few lines of python, using the notebook environment that you are most comfortable with.
You can step through the ML production process using the Wallaroo Tutorials and by setting up the free Community Edition. More ML Production learning resources from Wallaroo.ai can be found on our YouTube channel and blogs.
Posted on March 11, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.