Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Azure Machine Learning Engineering

You're reading from   Azure Machine Learning Engineering Deploy, fine-tune, and optimize ML models using Microsoft Azure

Arrow left icon
Product type Paperback
Published in Jan 2023
Publisher Packt
ISBN-13 9781803239309
Length 362 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (4):
Arrow left icon
Balamurugan Balakreshnan Balamurugan Balakreshnan
Author Profile Icon Balamurugan Balakreshnan
Balamurugan Balakreshnan
Dennis Michael Sawyers Dennis Michael Sawyers
Author Profile Icon Dennis Michael Sawyers
Dennis Michael Sawyers
Sina Fakhraee Ph.D Sina Fakhraee Ph.D
Author Profile Icon Sina Fakhraee Ph.D
Sina Fakhraee Ph.D
Megan Masanz Megan Masanz
Author Profile Icon Megan Masanz
Megan Masanz
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1: Training and Tuning Models with the Azure Machine Learning Service
2. Chapter 1: Introducing the Azure Machine Learning Service FREE CHAPTER 3. Chapter 2: Working with Data in AMLS 4. Chapter 3: Training Machine Learning Models in AMLS 5. Chapter 4: Tuning Your Models with AMLS 6. Chapter 5: Azure Automated Machine Learning 7. Part 2: Deploying and Explaining Models in AMLS
8. Chapter 6: Deploying ML Models for Real-Time Inferencing 9. Chapter 7: Deploying ML Models for Batch Scoring 10. Chapter 8: Responsible AI 11. Chapter 9: Productionizing Your Workload with MLOps 12. Part 3: Productionizing Your Workload with MLOps
13. Chapter 10: Using Deep Learning in Azure Machine Learning 14. Chapter 11: Using Distributed Training in AMLS 15. Index 16. Other Books You May Enjoy

Connecting AMLS to VS Code

VS Code is an IDE designed to work with Windows, macOS, or Linux. Its Git integration and debugging features make it a natural selection for a code editor. VS Code has an extension for working directly with your AMLS environment to build, train, and deploy ML models. In order to leverage this powerful tool, install and configure VS Code by following these steps:

  1. Download and install VS Code at https://code.visualstudio.com/download.
  2. From within VS Code, click on the EXTENSIONS icon (Ctrl + Shift + x), search for Azure Machine Learning as shown in Figure 1.34, and select Install:
Figure 1.34 – Selecting the VS Code extension

Figure 1.34 – Selecting the VS Code extension

  1. Sign into your Azure account (Ctrl + Shift + p), and type the following:
    >Azure: Sign In

A new browser window will open for you to supply your credentials to enable sign-in.

  1. Set your default workspace, leveraging the command palette. In order to set your default AMLS workspace, you will need to have a folder open in which VS Code can store metadata. This can be done by selecting File from the menu and selecting Open Folder.
  2. Choose your default workspace by leveraging the command palette (Ctrl + Shift + p) and type Azure ML: Set Default Workspace. This command will walk you through selecting your subscription and your workspace:
     >Azure ML: Set Default Workspace
  3. Go to the Azure icon (Shift + Alt + A), and go to MACHINE LEARNING as shown in Figure 1.35:

Figure 1.35 – Azure icon

Figure 1.35 – Azure icon

  1. Inside the Machine Learning section of the Azure icon, right-click as shown in Figure 1.36 and select Connect for our compute instance:

Figure 1.36 – Connect to compute instance

Figure 1.36 – Connect to compute instance

  1. The VS Code extension will be installed on the compute instance you are connecting to and you will be asked whether you trust the authors of all files in the parent folder. Select Yes, I trust the authors.
  2. This will open a new instance of VS Code on your local machine. In this new instance of VS Code, you will see the user directory and notebook previously created in the Developing using an AML notebook section as shown in Figure 1.37:

Figure 1.37 – Opening the notebook in VS Code

Figure 1.37 – Opening the notebook in VS Code

  1. Select your Python interpreter from the top-right corner by clicking on Select Kernel. Please select the azureml_py310_sdkv2 kernel:
Figure 1.38 – Select Kernel

Figure 1.38 – Select Kernel

  1. After the interpreter has been selected, you can create a print statement as shown in Figure 1.39:
Figure 1.39 – Writing code

Figure 1.39 – Writing code

  1. To execute this code, press the play button to the left of the cell (Ctrl + Enter). Note that the Python code supplied will print out the current working directory. Your code executes on the compute instance as shown by the directory path printed out.

Saving the notebook within VS Code will save the notebook to your AMLS workspace.

In this section, you have installed VS Code, the AML VS Code extension, and connected to your compute instance in your AMLS workspace to run your code. VS Code provides IntelliSense, the ability to run and debug your code, along with built-in Git integration. Combining these features with integration into your AMLS workspace makes this the ideal choice for development.

You have been reading a chapter from
Azure Machine Learning Engineering
Published in: Jan 2023
Publisher: Packt
ISBN-13: 9781803239309
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime