Accelerate AI Model Computing with GPU on Cocalc

Updated on Mar 21,2024

Accelerate AI Model Computing with GPU on Cocalc

Table of Contents:

  1. Introduction
  2. Prerequisites
  3. Creating a Compute Server with a GPU
  4. Choosing the OAMA Image
  5. Starting the Compute Server
  6. Managing the Compute Server
  7. Downloading and Using OAMA Models
  8. Viewing Processes and System Status
  9. Customizing and Adding Models
  10. Termination and Cost Considerations

🚀 Introduction

In this Tutorial, we will explore how to use OAMA (OpenAI Model API) in Cal with a GPU. OAMA is a powerful tool that allows you to run pre-trained AI models on the cloud. By utilizing the GPU capabilities, you can accelerate your computations and achieve faster results. We will walk you through the steps, from creating a compute server, selecting the appropriate OAMA image, downloading and using models, and managing the server. Let's get started!

📚 Prerequisites

Before you begin, make sure you have the following prerequisites in place:

  • A Cal.com account
  • Access to the list of projects in your Cal.com account
  • Basic knowledge of GPU computing and cloud services

🖥️ Creating a Compute Server with a GPU

To use OAMA with a GPU, you need to create a compute server that supports GPU functionality. Follow these steps:

  1. Sign in to your Cal.com account and navigate to the list of projects.
  2. Open the project where you want to create the compute server.
  3. Click on "Create Computer Server" to begin the server creation process.
  4. Choose the OAMA image as the server template, as it comes pre-installed with OAMA and the OAMA web UI.
  5. Select the L4 GPU option, which offers fast performance and 24 GB of memory.
  6. Optionally, increase the disk space for storing data and models.
  7. Start the compute server and wait for it to become available.

🖼️ Choosing the OAMA Image

When creating the compute server, it is essential to choose the OAMA image instead of the PyTorch image. The OAMA image comes pre-installed with OAMA and the OAMA web UI. This allows you to have a customized domain name and access the OAMA web UI for easy model management. Ensure that you select the OAMA image from the available options.

▶️ Starting the Compute Server

Once you have created the compute server, it's time to start it up. Follow these steps:

  1. Check if the compute server has successfully started.
  2. If the compute server is a preemptable server or a spot instance, there is a possibility that it may not be available immediately. Retry or choose a different location if needed.
  3. While waiting for the compute server to start, you can also create a Linux terminal to run OAMA commands directly. This allows you to monitor the progress of model downloads and view precise stats.
  4. Once the compute server has started, you can either use the terminal or visit the customized domain name to access the OAMA web UI.

⚙️ Managing the Compute Server

To effectively manage the compute server and optimize its performance, consider the following:

  1. Monitoring Processes: Use the OAMA web UI or the Linux terminal to monitor the processes running on the compute server. You should see the OAMA server and the OAMA web UI processes.
  2. Checking GPU Usage: Utilize the nvidia-smi command in the Linux terminal to check the GPU usage. This helps you ensure that OAMA is running on the GPU and utilizing the available memory.
  3. Additional System Information: Use commands like top to view real-time CPU usage and check log files for monitoring errors or other system activities. Log files are located in the /var/log/supervisor directory.

📥 Downloading and Using OAMA Models

To use OAMA effectively, you need to download and utilize pre-trained models. Here's how you can do it:

  1. Choose the desired model from the OAMA web UI's model library.
  2. Download the model either through the web UI or using the Linux terminal with the olama pull command.
  3. Monitor the progress of model downloads through the terminal's real-time feedback.
  4. Once the model is downloaded, refresh the OAMA web UI to see the available models.
  5. Start a chat with the OAMA model and interact with it in real-time.

📊 Viewing Processes and System Status

To gain insights into the processes running on the compute server and Gather system information, utilize the following tools:

  1. OAMA Web UI: View the processes running on the compute server directly from the web UI. This provides an overview of the OAMA server and the OAMA web UI processes.
  2. Linux Terminal: Use commands like top to view real-time CPU usage and check log files located in the /var/log/supervisor directory for additional system information.

🧰 Customizing and Adding Models

To customize your OAMA experience and add new models, follow these steps:

  1. Access the OAMA web UI settings to customize domain names, API tokens, and more.
  2. Use the model browsing feature in the OAMA web UI to discover and download new models.
  3. Explore different model tags to find specific types and sizes of models to fit your needs.
  4. Download and load the desired models using the web UI or the Linux terminal.

⏹️ Termination and Cost Considerations

When you are done using the OAMA compute server, you have two options:

  1. Stop the Compute Server: This option allows you to keep the server configuration but stops the virtual machine, saving on compute costs. You will still incur storage costs for the disk space used.
  2. Deprovision the Compute Server: This option deletes the underlying disk and stops the virtual machine. If you choose this option, you will need to redownload the models when you want to use them again.

Most people like