Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024

Deep Learning VM Images

Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM

Introduction

You have already learned about Deep Learning that it is a key component of data science, including statistics and predictive models, and extremely useful for data scientists who need to collect, analyze, and interpret large amounts of data. Now, In this article, you will learn about Deep Learning Virtual Images in detail.

Deep Learning VM Images 

Deep Learning VM images are a set of virtual machine images optimized for data science and machine learning tasks. All images come pre-installed with leading ML frameworks and tools. Ready to use on GPU-equipped instances to accelerate data processing tasks. The

Deep Learning VM image supports many combinations of frameworks and processors. There are currently images supporting TensorFlow Enterprise, TensorFlow, PyTorch, and general high-performance computing, with versions for CPU-only and GPU-only workflows.

See Image Selection for a list of available frameworks.

The images are based on Debian10, Debian 9, and Ubuntu 20.04 operating systems and can be configured to include:

  • Specific frameworks (like TensorFlow) and supporting packages.
  • Python 3.7 with the following packages:
    • numpy
    • pandas
    • scipy
    • matplotlib
    • nltk
    • pillow
    • opencv-python
    • scikit-image
    • fairness-indicators for TensorFlow 2.3 and 2.4 Deep Learning VM instances
    • scikit-learn
    • many more
       
  • JupyterLab notebook environment for rapid prototyping
     
  • Nvidia packages with the latest Nvidia drivers for GPU-enabled instances:
    • CUDA 9.*, 10.*, and 11.* (the version depends on the framework)
    • CuDNN 7.* and NCCL 2.* (the version depends on the CUDA version)

 

Deep Learning VM Images | Google Cloud

 Source

Create a Deep Learning VM instance by using the console

This page describes how to create a Deep Learning VM Image instance using Google Cloud Marketplace in Google Cloud Console.

Before you get started

  1. If you are new to Google Cloud, create an account to evaluate the performance of your Google products in real-world scenarios. New customers will also earn $ 300 in free credit to run, test, and deploy their workloads.
  2. On the Google Cloud Console project selection page, select or create a Google Cloud project.
  3. Make sure billing is enabled for your cloud project. Learn how to check if your project has billing enabled.


Create a new Instance

  1. Go to the Deep Learning Virtual Machine Cloud Marketplace page in the console.
  2. Click Launch. Choose the project in which you need to create the instance if you see a project selection window.
  3.  The first time you start a Compute Engine virtual machine, you must wait for the first API configuration process to complete.
  4. On the Deploy New Deep Learning VM page, enter a deployment name. This is the root of the virtual machine's name. Compute Engine adds -vm to this name when naming the instance.
  5. Select a Zone, or keep the default.
  6. Under Machine type, select the specs you want for your VM or leave the default.
  7. Under GPU, select the type of GPU and the number of GPUs, or leave the defaults. If you don't want to use the GPU, click the Clear GPU button.
  8. There is an option to select Enable access to JupyterLab via URL instead of SSH (Beta). After enabling this beta feature, you will be able to access your JupyterLab instance via a URL. Anyone with an Editor or Owner role on your GCP project can access this URL. This feature currently works only in the United States, European Union, and Asia.
  9. Select a machine learning Framework, or keep the default.
  10. Click Deploy.


Access your new Instance

When you create a deep learning VM instance, it starts automatically. To access:

  1. Go to the VM Instances page in Google Cloud Console. Go to the VM Instances page
  2. In the Name column, click the name of the VM instance.

In the Remote Access section, click the first dropdown list and select how you want to access your instance. You can choose to interact using the graphical user interface or the command line.

Stop the instance

  1. Go to the Virtual Machine Instances page in the Google Cloud console. Go to the VM Instances page
  2. Select the checkbox next to the Deep Learning VM instance.
  3. Click Stop.

Start the instance

When an instance is created, it will start automatically. To manually start an instance if it's down:

  1. Go to the Virtual Machine Instances page in the Google Cloud Console. Go to the VM Instances page
  2. Check the check box next to the Deep Learning VM instance.
  3. Click Start.
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Create a Deep Learning VM instance by using the gcloud CLI

This page shows how to use the Google Cloud CLI to create a deep learning VM image instance.

Before you get started

  1. If you are new to Google Cloud, create an account to evaluate the performance of your product in real-world scenarios. New customers will also get $ 300 free credit to run, test, and deploy their workloads.
  2. On the Google Cloud Console project selection page, select or create a Google Cloud project
  3.  Make sure billing is enabled for your cloud project. Learn how to check if billing is enabled on a project

To use Google Cloud CLI with this quickstart, you must first install and initialize Google Cloud CLI.

  1. Follow the instructions for installing Google Cloud CLI to download and install Google Cloud CLI. 
  2. Initialize the SDK by following the steps in Initializing the Cloud SDK.

To use gcloud with CloudShell in this quickstart, first enable CloudShell using the Starting Cloud Shell.
 

Create a new instance

  • These steps create a deep learning VM instance with the following parameters: 
  • Using TensorFlow with a CUDA 9.2 image: tf-latest-cu92.
  • US West1-B Zone: us-west1-b.
  • Named my-new-instance.
  • Instance type n1-standard-8. 
  • Using NVIDIA Tesla V100 GPU: type = nvidia-tesla-v100, count = 8.
  • with 120 GB boot disk.
  • If the NVIDIA GPU driver is set to install on first run: install-nvidia-driver=True.

At the command line, enter the following:

export IMAGE_FAMILY="tf-latest-cu92"
export ZONE="us-west1-b"
export INSTANCE_NAME="my-new-instance"
export INSTANCE_TYPE="n1-standard-8"
gcloud compute instances create $INSTANCE_NAME \
        --zone=$ZONE \
        --image-family=$IMAGE_FAMILY \
        --image-project=deeplearning-platform-release \
        --maintenance-policy=TERMINATE \
        --accelerator="type=nvidia-tesla-v100,count=8" \
        --machine-type=$INSTANCE_TYPE \
        --boot-disk-size=120GB \
        --metadata="install-nvidia-driver=True"


After a while, the VM instance will be created and you will see an overview of its configuration.

Created the first Deep Learning VM instance. To see the instances and view their status, use the gcloud list command to list all the instances as follows:

gcloud compute instances list


This will allow you to see all the zones in your current project. All Compute Engine instances in are displayed. You can also view and manage Deep Learning VM instances in the Google Cloud Console for

Compute Engine VM instances.

To view the status of this instance only:

gcloud compute instances describe $ INSTANCE_NAME


Access your new instance

When you create a Deep Learning VM instance, it starts automatically. You can access it via SSH using the following command:

gcloud compute ssh $ INSTANCE_NAME


Compute Engine shares an SSH key and creates a user. For more information, see Connecting to Instances.


Stop the instance

Run the following command from your local machine (not on the instance):

gcloud compute instances stop $INSTANCE_NAME


The stop command performs a clean shutdown.


Start the instance

After the instance is initially created, Compute Engine starts it. To start the instance manually when it's stopped, run the following command:

gcloud compute instances start $INSTANCE_NAME


The start command starts a stopped virtual machine instance.


Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

To delete the Deep Learning VM instance that you created, at the command line, enter the following command:

gcloud compute instances delete $INSTANCE_NAME


The delete command deletes Compute Engine instances.

Choose an image 

Depending on the framework and processor you choose, a specific deep learning VM image is available. We currently have images that support TensorFlow, PyTorch, and general high-performance computing, with versions for CPU-only and GPU-only workflows. Refer to the table below to find the image you need.

Deciding on an image of family

Which deep learning VM image family you use depends on your needs. The given table lists the latest versions of the image family, organized by framework type. You can always get the latest version of an image by referencing an image family with the latest name in the name and creating an instance. If you need a specific framework version, go to the Listing all available versions.

Choosing an operating system

Debian 10 is the default operating system for most frameworks. Ubuntu 20.04 images are available for some frameworks. These are identified by the image family name suffix -ubuntu-2004 (see Listing all available versions). Debian 9 images are obsolete. The

PyTorch and TensorFlow Enterprise image families support the A100 GPU accelerator.

Included dependencies

A list of Python dependencies included in each release is available on Cloud Storage at

gs://deeplearning-platform-release/installed-dependencies/images/RELEASE_MILESTONE.


Replace RELEASE_MILESTONE with your release milestone. For example m88. For example, a list of M88 releases can be found at gs://deeplearning-platform-release/installed-dependencies/images/m88/.

TensorFlow Enterprise images

The TensorFlow Enterprise image family provides a distribution of TensorFlow optimized for Google Cloud. Certain versions of the TensorFlow Enterprise distribution also have Long Term Version  Support. For more information about TensorFlow Enterprise, see TensorFlow Enterprise overview.

Use the following table of available TensorFlow images to select an image that contains the desired version of TensorFlow or TensorFlow Enterprise.

Experimental images

Some Deep Learning Virtual Machine image families are experimental, as shown in the table of image families. Experimental images are supported as much as possible and may not be updated with each updated or new release of the framework.

Specifying an image version

If the latest image is newer, also you can reuse the same image. This is very useful, for example, if you are creating a cluster and want to ensure that all images used to create new instances are always the same. Do not use image family names in this situation. This is because when the latest image is updated, some instances in the cluster will have different images.

Alternatively, you can find the exact name of the image, include the version number, and use that particular image to spawn new instances in your cluster.

To find the exact name of the latest image, use the following command on your device of choice or in Cloud Shell with the Google Cloud CLI: Replace IMAGE_FAMILY with the name of the image family for which you want the latest version number.

gcloud compute images describe-from-family IMAGE_FAMILY \
--project deeplearning-platt-release


Look for the name field in the output and use the image name specified there when creating a new instance.

Listing all available versions

If you need a specific framework or CUDA version, you can search the complete list of available images. To list all available Deep Learning VM images, use the following gcloud CLI command.

gcloud compute images list \
        --project deeplearning-platform-release \
        --no-standard-images


Image families are named in the format FRAMEWORK-VERSION-CUDA_VERSION(-experimental), where FRAMEWORK is the target library, VERSION is the framework version, and CUDA_VERSION is the version of the CUDA stack, if present.

For example, an image from the family tf-ent-2-8-cu113 has TensorFlow Enterprise 2.8 and CUDA 11.3.

Images, image families, and instances 

Deep Learning Virtual Machine  Images is a set of pre-built VM images with ready-to-use deep learning frameworks. Deep learning VM images make it easy to set up your deep learning model training environment by pre-configuring dependencies, pre-installing key tools, and by optimizing performance.
It is very important to differenciate between the images, image families, and instances.

Image families

An image family is a set of images preconfigured for a specific purpose or using a specific architecture.

There are many deep learning VM image families. They are listed below for each main framework installed:

  • TensorFlow Enterprise family, with or without GPU, no GPU
  • TensorFlow family, with or without GPU
  • PyTorch family, with or without GPU
  • R experimental family
  • RAPIDS experimental family
  • Chainer experimental family, with or without GPU
  • XGBoost experimental family, with or without GPU
  • CNTK experimental family, with or without GPU
  • Caffe experimental family, with or without GPU
  • base or "generic" image family. No GPU


TensorFlow Enterprise is a distribution of TensorFlow optimized to run on Google Cloud and includes Long Term Version Support.

To choose between the TensorFlow Enterprise family and the TensorFlow family, consider the desired version of TensorFlow. The TensorFlow Enterprise family includes TensorFlow 1.15 and TensorFlow 2.1. The TensorFlow family includes previous versions of TensorFlow.

If you know which framework to use and whether to enable one or more GPUs, choose between using the latest version of the framework or an older version if available. increase. Deep learning VM images are available for some previous versions of the framework. For more information, see Choosing an Image.

Images

An image is an individual template of a virtual machine. Deep Learning Virtual Machine images are preconfigured public Compute VM images. For more information about Virtual Machine images, see the Concept Images topic in the Compute Engine documentation.

To select a deep learning VM image, see Select Choosing an Image.

Instances

An instance is a single virtual machine hosted on Google's infrastructure. A Deep Learning Virtual Machine instance is based on one of the preconfigured Deep Learning VM images. Create an instance from an image using the Google Cloud Console or Google Cloud CLI.

To select a deep learning VM image, see Choosing an Image. To create an instance of the Deep Learning VM image, see:

General Creation Information For instances on Compute Engine, see  Virtual Machine Instances.

Connect to JupyterLab 

When you start a Deep Learning VM Images instance, a JupyterLab session is initialized.

To set up SSH port forwarding, complete the following steps, and then access your JupyterLab session through a local browser:

  1. Run the following command by using the Google Cloud CLI in your preferred terminal or in Cloud Shell:
gcloud compute ssh \
    --project PROJECT_ID \
    --zone ZONE \
    INSTANCE_NAME \
    -- -L 8080:localhost:8080


Replace the following:

2. Use your local browser to access the JupyterLab session.
After running the command on your local machine, go to https://localhost:8080 to access JupyterLab.
Access JupyterLab from Web Preview on port 8080 if you run the command using Cloud Shell,. 

Frequently Asked Questions

What is image classification in deep learning?

Image classification is a supervised learning problem: define a set of target classes (objects to identify in images), and train a model to recognize them using labeled example photos. Early computer vision models relied on raw pixel data as the input to the model.

Which tool can be used to build virtual machine images?

Virt-builder is a tool for quickly building new virtual machines. You can build a variety of VMs for local or cloud use, usually within a few minutes or less. Virt-builder also has many ways to customize these VMs.

What is a VM image?

A VM image is an executable image file from a VM; this image file is in a special storage format. We can create a new VM by uploading the image file to the physical machine. Usually some software, like mysql or ms office, is installed on these new VMs beforehand.

Conclusion

In this article, we discussed Deep Learning VM Images . We also discussed how to create a Deep Learning VM instance using different ways. We also discussed other terms like Images, image families, and instances etc.

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem Design, and many more. If you want to test your competency in programming, you may check out the mock test series and participate in the contests available on Coding Ninjas Studio!

Nevertheless, you may consider our paid courses to give your career an edge over others!

Upvote this blog if you find it helpful and engaging!

Happy Learning!

thank you image

 

Topics covered
1.
Introduction
2.
Deep Learning VM Images 
3.
Create a Deep Learning VM instance by using the console
3.1.
Before you get started
3.1.1.
Create a new Instance
3.1.2.
Access your new Instance
3.1.3.
Stop the instance
3.1.4.
Start the instance
4.
Create a Deep Learning VM instance by using the gcloud CLI
4.1.
Before you get started
4.1.1.
Create a new instance
4.1.2.
Access your new instance
4.1.3.
Stop the instance
4.1.4.
Start the instance
4.1.5.
Clean up
5.
Choose an image 
5.1.
Deciding on an image of family
5.1.1.
Choosing an operating system
5.1.2.
Included dependencies
5.2.
TensorFlow Enterprise images
5.3.
Experimental images
5.3.1.
Specifying an image version
5.3.2.
Listing all available versions
6.
Images, image families, and instances 
6.1.
Image families
6.2.
Images
6.3.
Instances
7.
Connect to JupyterLab 
8.
Frequently Asked Questions
8.1.
What is image classification in deep learning?
8.2.
Which tool can be used to build virtual machine images?
8.3.
What is a VM image?
9.
Conclusion