### Example Project Navigation Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/installing-trustyai-service-using-cli.adoc An example demonstrating how to navigate to a specific project named 'my-project'. ```bash oc project my-project ``` -------------------------------- ### Example Output of `pip list` Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/viewing-python-packages-installed-on-your-workbench.adoc This is an example of the output you can expect after running the `pip list` command. It shows an alphabetical list of packages and their versions, useful for verifying installations. ```text Package Version --------------------------------- ---------- aiohttp 3.7.3 alembic 1.5.2 appdirs 1.4.4 argo-workflows 3.6.1 argon2-cffi 20.1.0 async-generator 1.10 async-timeout 3.0.1 attrdict 2.0.1 attrs 20.3.0 backcall 0.2.0 ``` -------------------------------- ### Install Model Training Library Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/install-packages-and-jupyterlab.adoc Use this command to install the model training library 'training-hub'. ```bash pip install training-hub ``` -------------------------------- ### Clone AI Examples Repository Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/guided-example-build-a-kfp-pipeline-for-sdg.adoc Clone the repository containing the KFP pipeline for knowledge tuning example. This command is used to obtain the necessary example code. ```bash git clone https://github.com/red-hat-data-services/red-hat-ai-examples ``` -------------------------------- ### PyTorch FSDP Training Script Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/ref-example-kfto-pytorch-training-script-fsdp.adoc This script demonstrates how to set up and run a distributed training job using PyTorch's Fully Sharded Data Parallel (FSDP). It includes DDP setup, model definition, FSDP wrapping with CPU offload, and a basic training loop. Ensure PyTorch is installed with distributed support. ```python import os import sys import torch import torch.distributed as dist from torch.distributed.fsdp import FullyShardedDataParallel as FSDP, CPUOffload from torch.distributed.fsdp.wrap import always_wrap_policy from torch import nn, optim # Enable verbose logging for debugging os.environ["TORCH_DISTRIBUTED_DEBUG"] = "INFO" # Enables detailed FSDP logs def setup_ddp(): """Initialize the distributed process group dynamically.""" backend = "nccl" if torch.cuda.is_available() else "gloo" dist.init_process_group(backend=backend) local_rank = int(os.environ["LOCAL_RANK"]) world_size = dist.get_world_size() # Ensure the correct device is set device = torch.device(f"cuda:{local_rank}" if torch.cuda.is_available() else "cpu") torch.cuda.set_device(local_rank) if torch.cuda.is_available() else None print(f"[Rank {local_rank}] Initialized with backend={backend}, world_size={world_size}") sys.stdout.flush() # Ensure logs are visible in Kubernetes return local_rank, world_size, device def cleanup(): """Clean up the distributed process group.""" dist.destroy_process_group() class SimpleModel(nn.Module): """A simple model with multiple layers.""" def __init__(self): super(SimpleModel, self).__init__() self.layer1 = nn.Linear(1024, 512) self.layer2 = nn.Linear(512, 256) self.layer3 = nn.Linear(256, 128) self.layer4 = nn.Linear(128, 64) self.output = nn.Linear(64, 1) def forward(self, x): x = torch.relu(self.layer1(x)) x = torch.relu(self.layer2(x)) x = torch.relu(self.layer3(x)) x = torch.relu(self.layer4(x)) return self.output(x) def log_fsdp_parameters(model, rank): """Log FSDP parameters and sharding strategy.""" num_params = sum(p.numel() for p in model.parameters()) print(f"[Rank {rank}] Model has {num_params} parameters (sharded across {dist.get_world_size()} workers)") sys.stdout.flush() def log_memory_usage(rank): """Log GPU memory usage if CUDA is available.""" if torch.cuda.is_available(): torch.cuda.synchronize() print(f"[Rank {rank}] GPU Memory Allocated: {torch.cuda.memory_allocated() / 1e6} MB") print(f"[Rank {rank}] GPU Memory Reserved: {torch.cuda.memory_reserved() / 1e6} MB") sys.stdout.flush() def main(): local_rank, world_size, device = setup_ddp() # Initialize model and wrap with FSDP model = SimpleModel().to(device) model = FSDP( model, cpu_offload=CPUOffload(offload_params=not torch.cuda.is_available()), # Offload if no GPU auto_wrap_policy=always_wrap_policy, # Wrap all layers automatically ) print(f"[Rank {local_rank}] FSDP Initialized") log_fsdp_parameters(model, local_rank) log_memory_usage(local_rank) # Optimizer and criterion optimizer = optim.Adam(model.parameters(), lr=0.001) criterion = nn.MSELoss() # Dummy dataset (adjust for real-world use case) x = torch.randn(32, 1024).to(device) y = torch.randn(32, 1).to(device) # Training loop for epoch in range(5): model.train() optimizer.zero_grad() # Forward pass outputs = model(x) loss = criterion(outputs, y) # Backward pass loss.backward() optimizer.step() print(f"[Rank {local_rank}] Epoch {epoch}, Loss: {loss.item()}") log_memory_usage(local_rank) # Track memory usage sys.stdout.flush() # Ensure logs appear in real-time cleanup() if __name__ == "__main__": main() ``` -------------------------------- ### Example Llama Stack Server Log Output Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/deploying-llama-stack-server.adoc This is an example of the expected log output when the Llama Stack server starts successfully. ```text INFO: Started server process INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://['::', '0.0.0.0']:8321 ``` -------------------------------- ### Example MinIO Pod Status Output Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/guardrails-configuring-the-opentelemetry-exporter.adoc Example output showing a running MinIO pod. ```bash NAME READY STATUS RESTARTS AGE minio-5f8c9d7b6d-abc12 1/1 Running 0 30s ``` -------------------------------- ### Example Base Image Selection (Ray) Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-custom-training-image.adoc Example of specifying a Ray-based training image with CUDA support in a Dockerfile. ```bash FROM quay.io/modh/ray:2.47.1-py311-cu121 ``` -------------------------------- ### Set up Python Virtual Environment and Install Dependencies Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/migrating-pipelines-from-database-to-kubernetes-api.adoc Create a Python 3.11 virtual environment and install the necessary packages: `kfp`, `requests`, and `PyYAML`. ```bash echo "Set up the Python prerequisites" python3.11 -m venv .venv ./.venv/bin/pip install kfp requests PyYAML ``` -------------------------------- ### Llama Model Server Running Log Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/deploying-a-llama-model-with-kserve.adoc Example log output from a Llama model server indicating that it is listening and the application has started successfully. ```log INFO 2025-05-15 11:23:52,750 __main__:498 server: Listening on ['::', '0.0.0.0']:8321 INFO: Started server process [1] INFO: Waiting for application startup. INFO 2025-05-15 11:23:52,765 __main__:151 server: Starting up INFO: Application startup complete. INFO: Uvicorn running on http://['::', '0.0.0.0']:8321 (Press CTRL+C to quit) ``` -------------------------------- ### Install Synthetic Data Generation Library Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/install-packages-and-jupyterlab.adoc Use this command to install the synthetic data generation library 'sdg-hub'. ```bash pip install sdg-hub ``` -------------------------------- ### Example feature_store.yaml Content Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-feature-store-instance-in-a-project.adoc This is an example of the `feature_store.yaml` file content, showing the project name, provider, online store path and type, and registry configuration. ```yaml project: my_feast_project provider: local online_store: path: /feast-data/online_store.db type: sqlite registry: path: /feast-data/registry.db registry_type: file auth: type: no_auth entity_key_serialization_version: 3 ``` -------------------------------- ### Running KServe and ODH Controller Pods Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/deploying-a-llama-model-with-kserve.adoc Example output showing the status of kserve-controller-manager and odh-model-controller pods. Indicates they are running. ```shell kserve-controller-manager-7c865c9c9f-xyz12 1/1 Running 0 4m21s odh-model-controller-7b7d5fd9cc-wxy34 1/1 Running 0 3m55s ``` -------------------------------- ### Example Directory Structure Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/storing-a-model-in-oci-image.adoc This is an example output of the 'tree' command, showing the expected location of the model file within the directory structure. ```text . ├── Containerfile └── models └── 1 └── mobilenetv2-7.onnx ``` -------------------------------- ### Example TempoStack Pod Status Output Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/guardrails-configuring-the-opentelemetry-exporter.adoc Example output showing running TempoStack pods. ```bash NAME READY STATUS RESTARTS AGE tempo-sample-compactor-0 1/1 Running 0 2m tempo-sample-distributor-7d9c8f5b6d-xyz12 1/1 Running 0 2m tempo-sample-ingester-0 1/1 Running 0 2m tempo-sample-querier-5f8c9d7b6d-abc34 1/1 Running 0 2m tempo-sample-query-frontend-6c7d8e9f7g-def56 1/1 Running 0 2m ``` -------------------------------- ### Install Required Packages Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/configuring-the-fine-tuning-job-v2.adoc Installs the kubeflow and training-hub packages. Ensure you are using the correct index URL for your environment. ```python !pip install kubeflow --index-url https://console.redhat.com/api/pypi/public-rhai/rhoai/3.2/cuda12.9-ubi9/simple/ !pip install training-hub==0.3.0 ``` -------------------------------- ### Install Python Packages Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/installing-python-packages-on-your-code-server-workbench.adoc Install all packages listed in the `requirements.txt` file into your code-server workbench environment. ```bash pip install -r requirements.txt ``` -------------------------------- ### Example response for listing models Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/make-api-calls-to-maas-models.adoc Example response in OpenAI-compatible format when listing available models. ```json { "object": "list", "data": [ { "id": "facebook-opt-125m", "object": "model", "created": 1234567890, "owned_by": "llm", "ready": true }, { "id": "llama-2-7b-chat", "object": "model", "created": 1234567890, "owned_by": "llm", "ready": true } ] } ``` -------------------------------- ### Install Kubeflow SDK Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-kubeflow-trainer-trainjob-resource-by-using-the-sdk.adoc Install the Kubeflow SDK using pip. Ensure you use the correct index URL for your environment. ```bash pip install kubeflow --index-url https://console.redhat.com/api/pypi/public-rhai/rhoai/3.2/cuda12.9-ubi9/simple/ ``` -------------------------------- ### Example Git Clone Command Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/uploading-an-existing-notebook-file-to-code-server-from-a-git-repository-using-cli.adoc An example of cloning a GitHub repository. This command initiates the download of the repository's contents. ```bash $ *git clone https://github.com/example/myrepo.git* Cloning into 'myrepo'... remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (10/10), done. remote: Total 2821 (delta 1), reused 5 (delta 1), pack-reused 2810 Receiving objects: 100% (2821/2821), 39.17 MiB | 23.89 MiB/s, done. Resolving deltas: 100% (1416/1416), done. ``` -------------------------------- ### Install Data Processing Library Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/install-packages-and-jupyterlab.adoc Use this command to install the data processing library 'docling'. ```bash pip install docling ``` -------------------------------- ### Install Model Training Library with CUDA Support Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/install-packages-and-jupyterlab.adoc Install the model training library with CUDA support by appending '[cuda]' to the package name. ```bash pip install training-hub[cuda] ``` -------------------------------- ### Example kube-auth-proxy Log Output Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/troubleshooting-common-problems-gateway-api.adoc This is an example of expected log output from the `kube-auth-proxy` pods, indicating successful configuration and startup on ports 4180 and 8443. ```bash # Expected output time="2024-01-15T10:30:00Z" level=info msg="OAuth2 Proxy configured" time="2024-01-15T10:30:00Z" level=info msg="OAuth2 Proxy starting on :4180" time="2024-01-15T10:30:00Z" level=info msg="OAuth2 Proxy starting on :8443" ``` -------------------------------- ### Install Required Python Packages Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/using-llama-stack-external-evaluation-provider-with-lm-evaluation-harness-in-TrustyAI.adoc Installs the necessary packages from PyPI, including llama-stack, llama-stack-client, and llama-stack-provider-lmeval. ```bash pip install \ llama-stack \ llama-stack-client \ llama-stack-provider-lmeval ``` -------------------------------- ### Example Output of pip list Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/viewing-python-packages-installed-on-your-code-server-workbench.adoc This is an example of the output you can expect after running the `pip list` command, showing package names and their versions. ```text Package Version ------------------------ ---------- asttokens 2.4.1 boto3 1.34.162 botocore 1.34.162 cachetools 5.5.0 certifi 2024.8.30 charset-normalizer 3.4.0 comm 0.2.2 contourpy 1.3.0 cycler 0.12.1 debugpy 1.8.7 ``` -------------------------------- ### Example Git Clone Command and Output Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/uploading-an-existing-notebook-file-to-jupyterlab-from-a-git-repository-using-cli.adoc An example of executing the `git clone` command with a sample URL and the subsequent output indicating a successful clone. ```bash [1234567890@jupyter-nb-jdoe ~]$ *git clone https://github.com/example/myrepo.git* Cloning into 'myrepo'... remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (10/10), done. remote: Total 2821 (delta 1), reused 5 (delta 1), pack-reused 2810 Receiving objects: 100% (2821/2821), 39.17 MiB | 23.89 MiB/s, done. Resolving deltas: 100% (1416/1416), done. ``` -------------------------------- ### Install Dependencies for Fine-Tuning Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/configuring-the-fine-tuning-job.adoc Installs the `yamlmagic` package and the Kubeflow Trainer SDK. Use this snippet to set up your environment before configuring the fine-tuning job. ```bash # Install the yamlmagic package !pip install yamlmagic %load_ext yamlmagic !pip install git+https://github.com/kubeflow/trainer.git@release-1.9#subdirectory=sdk/python ``` -------------------------------- ### Enable EPEL on UBI9 Images Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-custom-image-from-your-own-image.adoc This command installs the EPEL repository on UBI9-based images, which is required for installing certain software packages like RStudio. ```bash RUN yum install -y https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm ``` -------------------------------- ### Download File from Bucket Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/downloading-files-from-bucket.adoc An example of using the `download_file()` method to download a specific CSV file from an S3 bucket to a local path on your workbench. ```python s3_client.download_file('aqs086-image-registry', 'series35-image36-086.csv', '\tmp\series35-image36-086.csv_old') ``` -------------------------------- ### Install requests library Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/ingesting-content-into-a-llama-model.adoc Install the requests library if it is not already available in your workbench environment. This library is required for downloading example documents. ```python %pip install requests ``` -------------------------------- ### TrustyAI Service Pod Naming Convention Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/installing-trustyai-service-using-dashboard.adoc This is an example of the naming pattern for a running TrustyAI service pod. It is used for verification after installation. ```text trustyai-service-5d45b5884f-96h5z ``` -------------------------------- ### Navigate to Project Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/installing-trustyai-service-using-cli.adoc Command to switch to the project containing the models you want to monitor. ```bash oc project ____ ``` -------------------------------- ### Example Image Build Command Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-custom-training-image.adoc Example command to build a custom training image, tagging it with the name defined in the IMG environment variable and version 0.0.1. ```bash podman build -t ${IMG}:0.0.1 -f Dockerfile ``` -------------------------------- ### Run rocminfo Command Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/verifying-amd-gpu-availability-on-your-cluster.adoc Execute the `rocminfo` command to get detailed information about the AMD GPU if the ROCm stack is installed. ```bash rocminfo ``` -------------------------------- ### Define System Instructions and Examples for Financial Analysis Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/openai-compatible-apis-in-llama-stack.adoc Sets up system instructions and example Q&A pairs for a financial analysis assistant. This is used to configure the behavior and knowledge base of the AI model for specific tasks. ```python from rich import print from rich.table import Table system_instructions = """You are a financial document analysis assistant specialized in quarterly earnings reports, annual filings, press releases, and earnings call transcripts. You are designed to answer questions in a concise and professional manner. Answer questions strictly using only the provided documents. Base every answer strictly on the retrieved document content and cite the relevant section or excerpt ID. Do not use outside knowledge. Do not guess, infer missing data, or fabricate numbers. If the answer is not found in the retrieved content, reply: \"I couldn't find relevant information in the available files or my own knowledge.\" Be concise, precise, and factual.""" examples = [ { "input_query": "What do you know about IBM earnings in Q4, 2025? Summarize in one sentence", "expected_answer": "IBM reported strong fourth-quarter results with revenue rising 12% to $19.7 billion, driven by double-digit growth in its Software and Infrastructure segments and a generative AI book of business that has now surpassed $12.5 billion" }, { "input_query": "What was the total value of IBM's generative AI book of business as reported in the fourth quarter of 2025?", "expected_answer": "IBM reported that its generative AI book of business now stands at more than $12.5 billion." }, { "input_query": "What was IBM's reported free cash flow for the full year of 2025?", "expected_answer": ( "IBM reported a full-year free cash flow of $14.7 billion, which was an increase of $2.0 billion year-over-year" ) }, { "input_query": "How did the Software segment perform in terms of revenue during the fourth quarter of 2025?", "expected_answer": ( "The Software segment generated $9.0 billion in revenue, representing an increase of 14 percent (or 11 percent at constant currency)" ) }, ] # Use the Responses API to create a results table comparing not using vs using ``` -------------------------------- ### Example YAML for a Serving Runtime Resource Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-project-scoped-resources.adoc This YAML snippet demonstrates the structure for creating a Serving Runtime resource. It includes metadata such as name and namespace, along with specifications for the runtime's behavior and display name. Ensure the `metadata.namespace` and `metadata.name` are unique within the target project. ```yaml apiVersion: serving.kserve.io/v1alpha1 kind: ServingRuntime metadata: annotations: openshift.io/display-name: "SageMaker Compatible Endpoint" opendatahub.io/run-on-gpu: "false" name: sagemaker-compatible namespace: jupyterhub spec: grpcEndpoint: "http://sagemaker-compatible.jupyterhub.svc.cluster.local:8080" modelAvailableTimeout: 600 modelLoadTimeout: 1200 protocolType: "http" serviceAccountName: "default" supportedModelFormats: - name: "sagemaker" version: "1.0" ``` -------------------------------- ### Example of Insufficient Memory Error in OpenShift Events Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/troubleshooting-common-problems-in-workbenches-for-users.adoc This log snippet shows an example of an 'Insufficient memory' error that might appear in the OpenShift *Events* section when a workbench fails to start. It indicates that the cluster does not have enough available memory on any nodes to schedule the workbench pod. ```text Server requested 2021-10-28T13:31:29.830991Z [Warning] 0/7 nodes are available: 2 Insufficient memory, 2 node(s) had taint {node-role.kubernetes.io/infra: }, that the pod didn't tolerate, 3 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't tolerate. ``` -------------------------------- ### Configure PyTorch Training for DDP Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/assemblies/example-kfto-pytorch-training-scripts.adoc Example script for configuring PyTorch training with Distributed Data Parallel (DDP). This setup is suitable for multi-GPU or multi-node training scenarios. ```python # Copyright 2023 NVIDIA CORPORATION & AFFILIATES. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import torch import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel as DDP def main(): # Initialize the distributed environment dist.init_process_group("nccl") # Get the rank and world size rank = dist.get_rank() world_size = dist.get_world_size() # Create a simple model model = torch.nn.Linear(10, 1).to("cuda") # Wrap the model with DDP ddp_model = DDP(model, device_ids=[rank]) # Create a dummy input tensor input_tensor = torch.randn(20, 10).to("cuda") # Perform a forward pass output = ddp_model(input_tensor) # Print the output shape on rank 0 if rank == 0: print(f"Output shape: {output.shape}") # Clean up the distributed environment dist.destroy_process_group() if __name__ == "__main__": main() ``` -------------------------------- ### Install Python packages from requirements.txt Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/installing-python-packages-on-your-workbench.adoc Use the `pip install -r` command in a notebook cell to install all packages listed in the `requirements.txt` file. This command installs the packages onto your workbench. ```python !pip install -r requirements.txt ``` -------------------------------- ### Install and Import Boto3 Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/examples/s3client_examples/s3client_examples.ipynb Installs and imports the necessary boto3 libraries for S3 interaction. Ensure pip is up-to-date before installing boto3. ```python #Upgrade pip to the latest version !pip3 install --upgrade pip #Install boto3 !pip3 install boto3 #Import boto3 libraries import os import boto3 from botocore.client import Config from boto3 import session #show Boto3 package version !pip3 show boto3 ``` -------------------------------- ### Create a New OpenShift Project Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/t-bias-setting-up-your-environment.adoc Create a new project named 'model-namespace' for the tutorial. This command should be run from the directory containing the downloaded tutorial files. ```bash oc new-project model-namespace ``` -------------------------------- ### Install Boto3 and Required Libraries Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-an-s3-client.adoc This code cell upgrades pip, installs the Boto3 library, and imports necessary modules for S3 interaction. It also displays the installed Boto3 version. ```python #Upgrade pip to the latest version !pip3 install --upgrade pip #Install Boto3 !pip3 install boto3 #Install Boto3 libraries import os import boto3 from botocore.client import Config from boto3 import session #Check Boto3 version !pip3 show boto3 ``` -------------------------------- ### Example Verified Annotations Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/enabling-metrics-for-existing-nim-deployment.adoc This is an example of the output you should see after successfully verifying the Prometheus annotations. ```json { "prometheus.io/path": "/metrics", "prometheus.io/port": "8000" } ``` -------------------------------- ### Install kfp Python package Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/running-distributed-data-science-workloads-from-ai-pipelines.adoc Installs the kfp Python package, which is a prerequisite for all AI pipelines. ```bash $ pip install kfp ``` -------------------------------- ### Switch to your project Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/setting-up-ragas-inline-provider.adoc Use this command to switch to your desired project. Replace `` with your project's name. ```terminal oc project ``` -------------------------------- ### Verify Kubeflow SDK Installation Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-kubeflow-trainer-trainjob-resource-by-using-the-sdk.adoc Verify the installation of the Kubeflow SDK by checking its package information. ```bash pip show kubeflow ``` -------------------------------- ### Enable User Workload Monitoring Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/t-bias-setting-up-your-environment.adoc Apply the configuration to enable user workload monitoring. This command should be run from the directory containing the downloaded tutorial files. ```bash oc apply -f 1-Installation/resources/enable_uwm.yaml ``` -------------------------------- ### Import LlamaStackClient and create client instance Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/ingesting-content-into-a-llama-model.adoc Import the LlamaStackClient class and create an instance of the client. Ensure the service or route URL used is reachable from your workbench. ```python from llama_stack_client import LlamaStackClient # Use the Llama Stack service or route URL that is reachable from the workbench. ``` -------------------------------- ### AsciiDoc NOTE Admonition Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/CLAUDE.md Example of how to use the NOTE admonition block in AsciiDoc for adding notes. ```asciidoc [NOTE] ==== Add note content here. ==== ``` -------------------------------- ### Verify RDMA Bandwidth (Client) Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/enabling-roce-for-distributed-llm-deployments.adoc Execute this command on the client pod to establish RDMA communication with the server. Replace with the client pod name, with your RDMA device, and with the server's IP address. ```bash $ oc exec -it -- ib_write_bw -d ``` -------------------------------- ### List Installed Python Packages Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/viewing-python-packages-installed-on-your-code-server-workbench.adoc Run this command in the code-server terminal to display all installed Python packages and their versions. ```bash pip list ``` -------------------------------- ### Install llama_stack_client Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/ingesting-content-into-a-llama-model.adoc Install the llama_stack_client library in your Jupyter notebook environment. This is a prerequisite for interacting with the Llama Stack SDK. ```python %pip install llama_stack_client ``` -------------------------------- ### Import Installed Python Package Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/installing-python-packages-on-your-code-server-workbench.adoc After installing a package, you must import it into your Python script or notebook to use its functionality. ```python import altair ``` -------------------------------- ### Example Notebook CR Description Output Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/api-workbench-creating.adoc This is an example output from the `oc describe notebook` command, showing the details of a created workbench, including its name, namespace, labels, annotations, and specifications. ```yaml Name: my-workbench Namespace: my-project Labels: Annotations: notebooks.kubeflow.org/last-activity: 2024-07-30T20:27:25Z notebooks.kubeflow.org/last_activity_check_timestamp: 2024-07-30T20:43:25Z notebooks.opendatahub.io/inject-oauth: true notebooks.opendatahub.io/last-image-selection: my-custom-notebook:1.0 notebooks.opendatahub.io/last-size-selection: Small notebooks.opendatahub.io/oauth-logout-url: /projects/my-project?notebookLogout=my-workbench opendatahub.io/accelerator-name: opendatahub.io/image-display-name: My Custom Notebook opendatahub.io/username: kube:admin openshift.io/description: openshift.io/display-name: My Workbench API Version: kubeflow.org/v1 Kind: Notebook Metadata: Creation Timestamp: 2025-03-06T13:27:25Z Generation: 1 Resource Version: 42316914 UID: 89f4....9e9-7c48-4f53-9397-05c....d21a Spec: Template: Spec: Affinity: Containers: Env: ``` -------------------------------- ### Valid Routes Preset Configuration Example (Different Detector Roles) Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/guardrails-gateway-config-parameters.adoc Demonstrates a valid routes preset configuration where detectors from the same server are used, but they have different roles (input vs. output), thus avoiding conflicts. ```yaml routes: - name: route1 detectors: - detector1 - detector3 ``` -------------------------------- ### Example Pod Status Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/guardrails-deploying-the-guardrails-orchestrator-service.adoc An example of the expected output when verifying pod status, indicating that the Guardrails Orchestrator is running. ```terminal NAME READY STATUS RESTARTS AGE guardrails-orchestrator-sample 3/3 Running 0 3h53m ``` -------------------------------- ### Example Output of OpenTelemetry Collector Pod Status Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/guardrails-configuring-the-opentelemetry-exporter.adoc Example output showing the status of an OpenTelemetry collector pod. ```terminal NAME READY STATUS RESTARTS AGE -collector-7d9c8f5b6d-abc12 1/1 Running 0 45s ``` -------------------------------- ### Example of Listing Feast Entities Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/ref-entities-list-command-feature-store.adoc This example demonstrates how to list all registered entities in the Feature Store and shows the expected output format, including NAME, DESCRIPTION, and TYPE. ```bash $ feast entities list NAME DESCRIPTION TYPE driver_id driver id ValueType.INT64 ``` -------------------------------- ### Label Project for Multi-Model Serving Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/t-bias-setting-up-your-environment.adoc Label the 'model-namespace' project to enable multi-model serving. This command should be run from the directory containing the downloaded tutorial files. ```bash oc label namespace model-namespace "modelmesh-enabled=true" --overwrite=true ``` -------------------------------- ### AsciiDoc IMPORTANT Admonition Example Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/CLAUDE.md Example of how to use the IMPORTANT admonition block in AsciiDoc for emphasizing important information. ```asciidoc [IMPORTANT] ==== Add important note content here. ==== ``` -------------------------------- ### Deploy Model Components Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/using-a-drift-metric-in-a-credit-card-scenario.adoc Deploy the storage container, serving runtime, and the credit model into your project's namespace. Ensure the namespace exists or is created. ```bash $ oc project model-namespace || true $ oc apply -f resources/model_storage_container.yaml $ oc apply -f resources/odh-mlserver-1.x.yaml $ oc apply -f resources/model_gaussian_credit.yaml ``` -------------------------------- ### Verify Feast CLI Installation Source: https://github.com/opendatahub-io/opendatahub-documentation/blob/main/modules/creating-a-feature-store-instance-in-a-project.adoc Run this command in the pod's terminal to confirm that the Feast CLI is installed and accessible. ```bash $ feast --help ```