Chapter 2. Set up your working environment
To set up your working environment for customizing models, complete these tasks:
- For disconnected environments, mirror the Python index.
Start a JupyterLab workbench that is pre-configured to use the Red Hat Python index to run example notebooks.
NoteThe default workbenches provided with the Red Hat OpenShift AI installation are pre-configured to use the Red Hat Python index, except for the Jupyter | TensorFlow | ROCm | Python 3.12 image. Instead, you must create a custom workbench image based on the following base image:
Red Hat Ecosystem catalog base image for rhai/base-image-rocm-6.4-rhel9
- From your running workbench, import example notebooks.
2.1. About the Red Hat Python index Copy linkLink copied to clipboard!
Red Hat AI includes a maintained Python package index that provides secure and reliable access to supported libraries, with full support for disconnected environments.
For a list of packages in an index for a specific OpenShift AI release and runtime, go to the Red Hat AI Components Indexes page.
For details about Red Hat support for the Python package index, see Support philosophy: A secure platform.
2.2. Mirror the Python index for your disconnected environment Copy linkLink copied to clipboard!
If you are using a disconnected environment, use the following code example to access the Red Hat Python index content and copy it locally. You can then upload the packages into your own internal hosting service:
#!/bin/bash -x
URL=https://packages.redhat.com/api/pypi/public-rhai/rhoai/3.4/cuda12.9-ubi9/simple/
wget \
--verbose \ # Show detailed progress
--mirror \ # Mirror the directory structure
--continue \ # Resume partial downloads
--no-host-directories \ # Don't create host-named directories
--cut-dirs=4 \ # Remove first 4 path segments
$URL
2.3. Install packages and JupyterLab Copy linkLink copied to clipboard!
To ensure reliable and secure access to supported libraries, start your model customization workflow with a JupyterLab workbench that is pre-configured with theRed Hat Python index.
When you use one of the images, both pip and uv commands are pre-configured to use the Red Hat Python index and system trust store for HTTPS.
When you run a pip install command, it installs the package version referenced in the Red Hat Python index, ensuring that you are installing a version of the library that is secure and reliably accessible.
For example, use the following commands to install the model customization libraries:
Install the data processing library:
pip install doclingInstall the synthetic data generation library:
pip install sdg-hubInstall the model training library:
pip install training-hubInstall the model training library with CUDA support:
pip install training-hub[cuda]For additional options and details for installing the model training library, see Training Hub installation guidelines.
Install the inference time scaling library:
pip install its-hub
2.4. Import example notebooks Copy linkLink copied to clipboard!
To get started with customizing your models, you can run provided example notebooks and scripts. The following table lists the Git repositories that provide example notebooks for each model customization component.
For a comprehensive tutorial that demonstrates an AI/ML workflow, see the Knowledge Tuning example on the Red Hat AI examples site.
The Knowledge Tuning tutorial is a curated collection of Jupyter notebooks that includes examples of using Docling to process data, Training Hub to fine-tune a model on that data, and KServe to deploy the final model for a Question and Answer application.
| Model customization component | Git clone example repository | Branch | Directory |
|---|---|---|---|
| Data processing using Docling |
|
|
|
| Synthetic data generation |
|
|
|
| Training |
|
|
|
| End-to-end example for model customization with these components |
|
|
|
2.4.1. Clone an example Git repository Copy linkLink copied to clipboard!
Follow these steps to clone a Git repository from the JupyterLab environment provided with your OpenShift AI workbench.
Prerequisites
- You have the https URL and branch for one of the example Git repositories listed in Table 2.2.
Procedure
- From the OpenShift AI dashboard, go to the project where you created a workbench.
Click the link for your workbench. If prompted, log in and allow JupyterLab to authorize your user.
Your JupyterLab environment window opens.
The file-browser window shows the files and directories that are saved inside your own personal space in OpenShift AI .
Bring the content of an example Git repo inside your JupyterLab environment:
- On the toolbar, click the Git Clone icon.
- Enter a Git https URL.
- Select the Include submodules option, and then click Clone.
If you want to use a branch other than
main(for example, the data processing example repo uses thestable-3.0branch), change the branch:- In the left navigation bar, click the Git icon, and then click Current Branch to expand the branches and tags selector panel.
- On the Branches tab, in the Filter field, enter the branch name.
Select the branch.
The current branch changes to the branch that you selected.
Verification
- In the file browser, double-click the newly-created directory to see the example files.