Introduction to OpenShift AI

In this learning exercise, we will start OpenShift AI within the OpenShift cluster, guide you through accessing the OpenShift AI dashboard, and illustrate the procedure for retrieving a GitHub repository within the JupyterLab environment. Using JupyterLab, you will execute sample machine learning programs.

Try it in our Sandbox 

Prerequisites:


Step-by-step guide:

1. Explore the OpenShift AI dashboard

In this section, you will discover how to start an OpenShift AI instance from the OpenShift Sandbox cluster, enabling exploration of the myriad possibilities offered by artificial intelligence and machine learning. The following steps will guide you through the process of getting started with OpenShift AI.

  • First, log in to your OpenShift Sandbox cluster.
  • From the OpenShift dashboard, click the cube icon on the top right.
  • You will see the Red Hat OpenShift AI option in the dropdown menu as shown in the following Figure 1. Click on it.

    The OpenShift Sandbox comes with pre-installed OpenShift AI. You can access it from the Red Hat Applications tile dropdown menu. Select the option of authentication by clicking Log in with OpenShift.
    Figure 1: Red Hat OpenShift AI option available in the OpenShift sandbox.
  • Click on "Log in with OpenShift" and sign in with your username and password for your OpenShift cluster.

    Authorization is necessary to access OpenShift AI.
    Figure 2: OpenShift Login.

You will land on the OpenShift AI dashboard as shown below. The Explore tab will offer you more options for applications of Red Hat OpenShift AI instances.

On the dashboard, we can see "Enabled" applications such as Jupyter, which come built-in and supported by Red Hat, similar to the following Figure 3 below.

The left menu includes an 'Enabled' option. Selecting this option will display a list of pre-installed applications on OpenShift AI.
Figure 3: Red Hat OpenShift AI includes pre-installed applications.

Under the "Applications" section, locate the "Enabled" option to find active instances of AI application development. By default, Jupyter is already activated, and we will utilize it within this learning exercise.

In the OpenShift AI dashboard's application section, you'll find the option to 'Explore' OpenShift AI instances.
Figure 4: Red Hat OpenShift offers a multitude of instances.

The Resources link offers tutorials and documentation on how to use OpenShift AI, including partner software. Quick starts are embedded in the application itself and offer an in-line tutorial experience.

2. Navigate to the Data Science project

In the Sandbox environment, a Data Science project is pre-created for your convenience. Please navigate to and open this project to set up a Workbench.

  • Click on "Data Science Projects".
  • You should see the pre-created Data Science project with your username.
  • Click on it to open the project.

3. Create the Workbench for Jupyter notebook server 

The Data Science Project serves as a registry for the Jupyter notebook we will create. You will be directed to the component page of the Data Science project. On this page, we need to define the configurations of Jupyter Notebook server images, such as Simple Data Science, TensorFlow, PyTorch, and others. Additionally, we can specify the server size, similar to Figure 6.

The workbench will select the server image for the Jupyter Notebook.
Figure 6: Create Workbenches.
  • Select the Workbenches component option and click on the "Create Workbench" option.
  • Give it a name.
  • Select the Notebook image from the image selection dropdown as Standard Data Science.
  • Select the Container size to small under "Deployment size".
  • Scroll down and in the storage cluster, give it a storage name.
  • Define the required storage size in Gi. Set the storage size to 10 Gi.

Note: The OpenShift Developer Sandbox has a storage restriction, limiting it to 15GB. Therefore, default values cannot be used in this context.

The workbench form provides options to select configurations for notebooks.
Figure 7: Configuration selection for Jupyter notebook.
  • Click on Create workbench.
The review page displays both the workbench, cluster storage, Data Connections and Model Servers.
Figure 8: Workbench is in Running state.

After successful implementation, the status of the workbench turns to "Running," similar to as shown in the above image.

  • Click on the "Open" button, beside the status.
  • Authorize access with the OpenShift cluster by clicking on the "Allow selected permissions", as shown in Figure 9.
OpenShift requests permission to access the notebook in the browser.
Figure 9: Permission granting

After granting permissions with OpenShift, you will be directed to the Jupyter Notebook page, resembling Figure 10 below.

The Explore page of Jupyter Notebook provides a plethora of options to begin with.
Figure 10: Jupyter notebook landing page.

4. How to get the existing data science project in Jupyter notebook

The Jupyter notebook provides functionality to fetch or clone existing GitHub repositories, similar to any other standard IDE. Therefore, in this lesson, we will clone an existing simple ML/AI code into the notebook using the following instructions.

  • From the top, click on the "Git Clone" icon, similar to as shown in the following Figure 11.
Jupyter Notebook provides an option to fetch remote Git repositories.
Figure 11: Git clone option from toolbar.
In the popup window, enter the exercise of the remote Git URI.
Figure 12: URI of git.

After fetching the GitHub repository, the project will appear in the directory section on the left side of the notebook.

  • Checkout the “/openshift-ai/first-app/” directory.
  • Open the “openshift-ai-test.ipynb” file.

You will get the view of a Jupyter notebook.

5. Learn how to execute code in a Jupyter notebook

In the last lesson, we imported and opened the notebook. To execute, click on the "Execute" icon, as shown in Figure 13 below.

After clicking, you'll observe the transition to the next block of the notebook. Essentially, we've segmented the single program into multiple blocks. This approach facilitates easier development and debugging of the program.

Jupyter Notebook operates in cell form.
Figure 13: Executing code in notebook.

Summary

We guided you through accessing OpenShift AI from the OpenShift sandbox cluster and demonstrated the process of fetching a GitHub repository within the JupyterLab environment. Additionally, we explored using the Jupyter IDE and executing sample machine learning programs.

Our aim is to ensure the success of your data science projects, not just as experiments, but as part of the next generation of intelligent applications.

Previous resource
Overview: Introduction to OpenShift AI
Next resource
Additional resources