开始使用


Red Hat AI Inference Server 3.2

Red Hat AI Inference Server 入门

Red Hat AI Documentation Team

摘要

了解如何使用红帽 AI Inference Server for model serving and inferencing。

前言

Red Hat AI Inference Server 是一个容器镜像,它通过 LLMs 优化服务和推断。使用 AI Inference Server,您可以以增强其性能并降低成本的方式提供和推测模型。

第 1 章 关于 AI Inference Server

AI Inference 服务器提供企业级稳定性和安全性,基于上游开源软件进行构建。AI Inference 服务器利用上游 vLLM 项目,它提供第一流推测功能。

例如,AI Inference 服务器使用持续批处理来处理请求,而不必等待完整批处理被累积。它还使用 10sor parallelism 在多个 GPU 之间分发 LLM 工作负载。这些功能提高了延迟和更高的吞吐量。

要降低推断模型的成本,AI Inference 服务器使用页面关注。LLMs 使用一种称为注意的机制来理解与用户对话。通常,请注意,使用大量内存。通过为 LLM 置备内存,如虚拟内存可用于操作系统的方式,页面对此内存的注意。这个方法消耗较少的内存,这会降低成本。

要验证 AI Inference Server 节约成本和性能提高,请完成以下步骤:

  1. 使用 AI Inference Server 提供和推断
  2. 使用关键指标验证 Red Hat AI Inference 服务器的好处

第 2 章 产品和版本兼容性

下表列出了 Red Hat AI Inference Server 3.2、Red Hat Enterprise Linux AI 3.0 和 Red Hat OpenShift AI 3.0 支持的产品版本。

Expand
表 2.1. AI Inference Server 产品和版本兼容性
产品版本vLLM 内核版本LLM Compressor 版本

3.2.5

v0.11.2

v0.8.1

3.2.4

v0.11.0

v0.8.1

3.2.3

v0.11.0

v0.8.1

3.2.2

v0.10.1.1

v0.7.1

3.2.1

v0.10.0

这个版本不包括

3.2.0

v0.9.2

这个版本不包括

Expand
表 2.2. Red Hat OpenShift AI 产品和版本兼容性
产品版本vLLM 内核版本LLM Compressor 版本

3.0

v0.11.0

v0.8.1

Expand
表 2.3. Red Hat Enterprise Linux AI 产品和版本兼容性
产品版本vLLM 内核版本LLM Compressor 版本

3.0

v0.11.0

v0.8.1

第 3 章 查看 AI Inference Server Python 软件包

您可以使用 Podman 运行容器并查看 pip 列表软件包输出来查看在 Red Hat AI Inference Server 容器镜像中安装的 Python 软件包

先决条件

  • 已安装 Podman 或 Docker。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 您可以访问 registry.redhat.io 并已登录。

流程

  1. 使用 pip list package 命令运行 Red Hat AI Inference Server 容器镜像,以查看所有已安装的 Python 软件包。例如:

    $ podman run --rm --entrypoint=/bin/bash \
      registry.redhat.io/rhaiis/vllm-cuda-rhel9:3.2.5 \
      -c "pip list"
  2. 要查看有关特定软件包的详细信息,请运行带有 pip show <package_name> 的 Podman 命令。例如:

    $ podman run --rm --entrypoint=/bin/bash \
      registry.redhat.io/rhaiis/vllm-cuda-rhel9:3.2.5 \
      -c "pip show vllm"

    输出示例

    Name: vllm
    Version: v0.11.2

使用 Podman 和在 NVIDIA CUDA AI 加速器上运行的 Red Hat AI Inference Server 提供大型语言模型。

先决条件

  • 已安装 Podman 或 Docker。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 您可以访问 registry.redhat.io 并已登录。
  • 您有一个 Hugging Face 帐户,并生成了一个 Hugging Face 访问令牌。
  • 您可以访问安装了数据中心 grade NVIDIA AI 加速器的 Linux 服务器。

注意

有关加速器支持的 vLLM 量化方案的更多信息,请参阅 支持的硬件

流程

  1. 在服务器主机上打开一个终端,并登录到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 运行以下命令拉取相关的 NVIDIA CUDA 镜像:

    $ podman pull registry.redhat.io/rhaiis/vllm-cuda-rhel9:3.2.5
  3. 如果您的系统启用了 SELinux,请将 SELinux 配置为允许设备访问:

    $ sudo setsebool -P container_use_devices 1
  4. 创建卷并将其挂载到容器中。调整容器权限,以便容器可以使用它。

    $ mkdir -p rhaiis-cache
    $ chmod g+rwX rhaiis-cache
  5. 创建或附加 HF_TOKEN Hugging Face 令牌到 private.env 文件。提供 private.env 文件。

    $ echo "export HF_TOKEN=<your_HF_token>" > private.env
    $ source private.env
  6. 启动 AI Inference Server 容器镜像。

    1. 对于 NVIDIA CUDA 加速器,如果主机系统有多个 GPU 并使用 NVSwitch,则启动 NVIDIA Fabric Manager。要检测您的系统是否使用 NVSwitch,请首先检查 /proc/driver/nvidia-nvswitch/devices/ 中是否存在文件,然后启动 NVIDIA Fabric Manager。启动 NVIDIA Fabric Manager 需要 root 特权。

      $ ls /proc/driver/nvidia-nvswitch/devices/

      输出示例

      0000:0c:09.0  0000:0c:0a.0  0000:0c:0b.0  0000:0c:0c.0  0000:0c:0d.0  0000:0c:0e.0

      $ systemctl start nvidia-fabricmanager
      重要

      只有在具有多个 GPU 的系统上需要使用 NVSwitch 的系统才需要 NVIDIA Fabric Manager。如需更多信息,请参阅 NVIDIA 服务器架构

      1. 运行以下命令,检查 Red Hat AI Inference Server 容器是否可以访问主机上的 NVIDIA GPU:

        $ podman run --rm -it \
        --security-opt=label=disable \
        --device nvidia.com/gpu=all \
        nvcr.io/nvidia/cuda:12.4.1-base-ubi9 \
        nvidia-smi

        输出示例

        +-----------------------------------------------------------------------------------------+
        | NVIDIA-SMI 570.124.06             Driver Version: 570.124.06     CUDA Version: 12.8     |
        |-----------------------------------------+------------------------+----------------------+
        | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
        | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
        |                                         |                        |               MIG M. |
        |=========================================+========================+======================|
        |   0  NVIDIA A100-SXM4-80GB          Off |   00000000:08:01.0 Off |                    0 |
        | N/A   32C    P0             64W /  400W |       1MiB /  81920MiB |      0%      Default |
        |                                         |                        |             Disabled |
        +-----------------------------------------+------------------------+----------------------+
        |   1  NVIDIA A100-SXM4-80GB          Off |   00000000:08:02.0 Off |                    0 |
        | N/A   29C    P0             63W /  400W |       1MiB /  81920MiB |      0%      Default |
        |                                         |                        |             Disabled |
        +-----------------------------------------+------------------------+----------------------+
        
        +-----------------------------------------------------------------------------------------+
        | Processes:                                                                              |
        |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
        |        ID   ID                                                               Usage      |
        |=========================================================================================|
        |  No running processes found                                                             |
        +-----------------------------------------------------------------------------------------+

      2. 启动容器。

        $ podman run --rm -it \
        --device nvidia.com/gpu=all \
        --security-opt=label=disable \ 
        1
        
        --shm-size=4g -p 8000:8000 \ 
        2
        
        --userns=keep-id:uid=1001 \ 
        3
        
        --env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \ 
        4
        
        --env "HF_HUB_OFFLINE=0" \
        -v ./rhaiis-cache:/opt/app-root/src/.cache:Z \ 
        5
        
        registry.redhat.io/rhaiis/vllm-cuda-rhel9:3.2.5 \
        --model RedHatAI/Llama-3.2-1B-Instruct-FP8 \
        --tensor-parallel-size 2 
        6
        1
        启用 SELinux 的系统需要。--security-opt=label=disable 防止 SELinux 重新标记卷挂载中的文件。如果您选择不使用此参数,您的容器可能无法成功运行。
        2
        如果您在共享内存时遇到问题,请将 -shm-size 增加到 8GB
        3
        将主机 UID 映射到容器中 vLLM 进程的有效 UID。您也可以 pass-- user=0,但这比 the- userns 选项不太安全。set-- user=0 在容器内以 root 身份运行 vLLM。
        4
        使用 Hugging Face API 访问令牌设置和导出 HF_TOKEN
        5
        启用 SELinux 的系统需要。在 Debian 或 Ubuntu 操作系统上,或者在不使用 SELinux 的情况下使用 Docker 时,:Z 后缀不可用。
        6
        在多个 GPU 上运行 AI Inference Server 容器时,set -tensor-parallel-size 与 GPU 的数量匹配。
  7. 在终端中的单独标签页中,使用 API 向模型发出请求。

    curl -X POST -H "Content-Type: application/json" -d '{
        "prompt": "What is the capital of France?",
        "max_tokens": 50
    }' http://<your_server_ip>:8000/v1/completions | jq

    输出示例

    {
        "id": "cmpl-b84aeda1d5a4485c9cb9ed4a13072fca",
        "object": "text_completion",
        "created": 1746555421,
        "model": "RedHatAI/Llama-3.2-1B-Instruct-FP8",
        "choices": [
            {
                "index": 0,
                "text": " Paris.\nThe capital of France is Paris.",
                "logprobs": null,
                "finish_reason": "stop",
                "stop_reason": null,
                "prompt_logprobs": null
            }
        ],
        "usage": {
            "prompt_tokens": 8,
            "total_tokens": 18,
            "completion_tokens": 10,
            "prompt_tokens_details": null
        }
    }

使用 Podman 和在 AMD ROCm AI Accelerator 上运行的 Red Hat AI Inference Server 提供大型语言模型。

先决条件

  • 已安装 Podman 或 Docker。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 您可以访问 registry.redhat.io 并已登录。
  • 您有一个 Hugging Face 帐户,并生成了一个 Hugging Face 访问令牌。
  • 您可以访问安装了数据中心等级 AMD ROCm AI Accelerators 的 Linux 服务器。

注意

有关加速器支持的 vLLM 量化方案的更多信息,请参阅 支持的硬件

流程

  1. 在服务器主机上打开一个终端,并登录到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 运行以下命令拉取 AMD ROCm 镜像:

    $ podman pull registry.redhat.io/rhaiis/vllm-rocm-rhel9:3.2.5
  3. 如果您的系统启用了 SELinux,请将 SELinux 配置为允许设备访问:

    $ sudo setsebool -P container_use_devices 1
  4. 创建卷并将其挂载到容器中。调整容器权限,以便容器可以使用它。

    $ mkdir -p rhaiis-cache
    $ chmod g+rwX rhaiis-cache
  5. 创建或附加 HF_TOKEN Hugging Face 令牌到 private.env 文件。提供 private.env 文件。

    $ echo "export HF_TOKEN=<your_HF_token>" > private.env
    $ source private.env
  6. 启动 AI Inference Server 容器镜像。

    1. 对于 AMD ROCm 加速器:

      1. 使用 amd-smi static -a 验证容器是否可以访问主机系统 GPU:

        $ podman run -ti --rm --pull=newer \
        --security-opt=label=disable \
        --device=/dev/kfd --device=/dev/dri \
        --group-add keep-groups \ 
        1
        
        --entrypoint="" \
        registry.redhat.io/rhaiis/vllm-rocm-rhel9:3.2.5 \
        amd-smi static -a
        1
        您必须属于 AMD 系统上的视频和呈现组才能使用 GPU。要访问 GPU,您必须将 --group-add=keep-groups 补充组选项传给容器。
      2. 启动容器:

        podman run --rm -it \
        --device /dev/kfd --device /dev/dri \
        --security-opt=label=disable \ 
        1
        
        --group-add keep-groups \
        --shm-size=4GB -p 8000:8000 \ 
        2
        
        --env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
        --env "HF_HUB_OFFLINE=0" \
        -v ./rhaiis-cache:/opt/app-root/src/.cache \
        registry.redhat.io/rhaiis/vllm-rocm-rhel9:3.2.5 \
        --model RedHatAI/Llama-3.2-1B-Instruct-FP8 \
        --tensor-parallel-size 2 
        3
        1
        --security-opt=label=disable 防止 SELinux 重新标记卷挂载中的文件。如果您选择不使用此参数,您的容器可能无法成功运行。
        2
        如果您在共享内存时遇到问题,请将 -shm-size 增加到 8GB
        3
        在多个 GPU 上运行 AI Inference Server 容器时,set -tensor-parallel-size 与 GPU 的数量匹配。
  7. 在终端中的单独标签页中,使用 API 向模型发出请求。

    curl -X POST -H "Content-Type: application/json" -d '{
        "prompt": "What is the capital of France?",
        "max_tokens": 50
    }' http://<your_server_ip>:8000/v1/completions | jq

    输出示例

    {
        "id": "cmpl-b84aeda1d5a4485c9cb9ed4a13072fca",
        "object": "text_completion",
        "created": 1746555421,
        "model": "RedHatAI/Llama-3.2-1B-Instruct-FP8",
        "choices": [
            {
                "index": 0,
                "text": " Paris.\nThe capital of France is Paris.",
                "logprobs": null,
                "finish_reason": "stop",
                "stop_reason": null,
                "prompt_logprobs": null
            }
        ],
        "usage": {
            "prompt_tokens": 8,
            "total_tokens": 18,
            "completion_tokens": 10,
            "prompt_tokens_details": null
        }
    }

在具有 Google TPU AI 加速器的 Google 云虚拟机中使用 Podman 或 Docker 和 Red Hat AI Inference Server 提供大型语言模型。

先决条件

  • 您可以访问配置了 Google TPU AI 加速器的 Google Cloud TPU 虚拟机。如需更多信息,请参阅:

  • 已安装 Podman 或 Docker。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 您可以访问 registry.redhat.io 镜像 registry 并已登录。
  • 您有一个 Hugging Face 帐户,并生成了一个 Hugging Face 访问令牌。
注意

有关加速器支持的 vLLM 量化方案的更多信息,请参阅 支持的硬件

流程

  1. 在 TPU 服务器主机上打开一个终端,并登录到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 运行以下命令拉取 Red Hat AI Inference Server 镜像:

    $ podman pull registry.redhat.io/rhaiis/vllm-tpu-rhel9:3.2.5
  3. 可选:验证主机中是否有 TPU。

    1. 在 Red Hat AI Inference Server 容器中打开 shell 提示符。运行以下命令:

      $ podman run -it --net=host --privileged -e PJRT_DEVICE=TPU --rm --entrypoint /bin/bash registry.redhat.io/rhaiis/vllm-tpu-rhel9:3.2.5
    2. 通过在容器 shell 提示符中运行以下 Python 代码来验证系统 TPU 访问和基本操作:

      $ python3 -c "
      import torch
      import torch_xla
      try:
          device = torch_xla.device()
          print(f'')
          print(f'XLA device available: {device}')
          x = torch.randn(3, 3).to(device)
          y = torch.randn(3, 3).to(device)
          z = torch.matmul(x, y)
          import torch_xla.core.xla_model as xm
          torch_xla.sync()
          print(f'Matrix multiplication successful')
          print(f'Result tensor shape: {z.shape}')
          print(f'Result tensor device: {z.device}')
          print(f'Result tensor: {z.data}')
          print('TPU is operational.')
      except Exception as e:
          print(f'TPU test failed: {e}')
          print('Try restarting the container to clear TPU locks')
      "

      输出示例

      XLA device available: xla:0
      Matrix multiplication successful
      Result tensor shape: torch.Size([3, 3])
      Result tensor device: xla:0
      Result tensor: tensor([[-1.8161,  1.6359, -3.1301],
              [-1.2205,  0.8985, -1.4422],
              [ 0.0588,  0.7693, -1.5683]], device='xla:0')
      TPU is operational.

    3. 退出 shell 提示符。

      $ exit
  4. 创建卷并将其挂载到容器中。调整容器权限,以便容器可以使用它。

    $ mkdir ./.cache/rhaiis
    $ chmod g+rwX ./.cache/rhaiis
  5. HF_TOKEN Hugging Face 令牌添加到 private.env 文件中。

    $ echo "export HF_TOKEN=<huggingface_token>" > private.env
  6. HF_HOME 变量附加到 private.env 文件。

    $ echo "export HF_HOME=./.cache/rhaiis" >> private.env

    提供 private.env 文件。

    $ source private.env
  7. 启动 AI Inference Server 容器镜像:

    podman run --rm -it \
      --name vllm-tpu \
      --network=host \
      --privileged \
      --shm-size=4g \
      --device=/dev/vfio/vfio \
      --device=/dev/vfio/0 \
      -e PJRT_DEVICE=TPU \
      -e HF_HUB_OFFLINE=0 \
      -v ./.cache/rhaiis:/opt/app-root/src/.cache \
      registry.redhat.io/rhaiis/vllm-tpu-rhel9:3.2.5 \
      --model Qwen/Qwen2.5-1.5B-Instruct \
      --tensor-parallel-size 1 \ 
    1
    
      --max-model-len=256 \ 
    2
    
      --host=0.0.0.0 \
      --port=8000
    1
    set- tensor-parallel-size,以匹配 TPU 的数量。
    2
    为了获得最佳性能,请将 max-model-len 参数设置为 low,因为您的工作负载允许。

验证

检查 AI Inference Server 服务器是否已启动。在终端中打开一个单独的标签页,并使用 API 发出模型请求:

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen2.5-1.5B-Instruct",
    "messages": [
      {"role": "user", "content": "Briefly, what colour is the wind?"}
    ],
    "max_tokens": 50
  }' | jq

输出示例

{
  "id": "chatcmpl-13a9d6a04fd245409eb601688d6144c1",
  "object": "chat.completion",
  "created": 1755268559,
  "model": "Qwen/Qwen2.5-1.5B-Instruct",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The wind is typically associated with the color white or grey, as it can carry dust, sand, or other particles. However, it is not a color in the traditional sense.",
        "refusal": null,
        "annotations": null,
        "audio": null,
        "function_call": null,
        "tool_calls": [],
        "reasoning_content": null
      },
      "logprobs": null,
      "finish_reason": "stop",
      "stop_reason": null
    }
  ],
  "service_tier": null,
  "system_fingerprint": null,
  "usage": {
    "prompt_tokens": 38,
    "total_tokens": 75,
    "completion_tokens": 37,
    "prompt_tokens_details": null
  },
  "prompt_logprobs": null,
  "kv_transfer_params": null
}

使用 Podman 和 Red Hat AI Inference Server 在带有 IBM Spyre AI 加速器的 IBM Power 上运行的大型语言模型。

先决条件

  • 对于安装的 Power AI Accelerators,您可以访问运行带有 IBM Spyre 的 RHEL 9.6 的 IBM Power 11 服务器。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 已安装 Podman。
  • 您可以访问 registry.redhat.io 并已登录。
  • 已安装 Service Report 工具。请参阅 IBM Power 系统服务及生产力工具
  • 您已创建了一个 发送的安全组,并将 Spyre 用户添加到组中。

流程

  1. 在服务器主机上打开一个终端,并登录到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 运行 servicereport 命令来验证 IBM Spyre 硬件:

    $ servicereport -r -p spyre

    输出示例

    servicereport 2.2.5
    
    Spyre configuration checks                          PASS
    
      VFIO Driver configuration                         PASS
      User memlock configuration                        PASS
      sos config                                        PASS
      sos package                                       PASS
      VFIO udev rules configuration                     PASS
      User group configuration                          PASS
      VFIO device permission                            PASS
      VFIO kernel module loaded                         PASS
      VFIO module dep configuration                     PASS
    
    Memlock limit is set for the sentient group.
    Spyre user must be in the sentient group.
    To add run below command:
            sudo usermod -aG sentient <user>
            Example:
            sudo usermod -aG sentient abc
            Re-login as <user>.

  3. 运行以下命令拉取 Red Hat AI Inference Server 镜像:

    $ podman pull registry.redhat.io/rhaiis/vllm-spyre:3.2.5
  4. 如果您的系统启用了 SELinux,请将 SELinux 配置为允许设备访问:

    $ sudo setsebool -P container_use_devices 1
  5. 使用 lspci -v 验证容器是否可以访问主机系统 IBM Spyre AI Accelerators:

    $ podman run -it --rm --pull=newer \
        --security-opt=label=disable \
        --device=/dev/vfio \
        --group-add keep-groups \
        --entrypoint="lspci" \
        registry.redhat.io/rhaiis/vllm-spyre:3.2.5

    输出示例

    0381:50:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0382:60:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0383:70:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0384:80:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)

  6. 创建卷以挂载到容器并调整容器权限,以便容器可以使用它。

    $ mkdir -p ~/models && chmod g+rwX ~/models
  7. granite-3.3-8b-instruct 模型下载到 models/ 文件夹中。如需更多信息,请参阅 下载模型
  8. VLLM_AIU_PCIE_IDS 变量收集 Spyre ID:

    $ lspci

    输出示例

    0381:50:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0382:60:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0383:70:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0384:80:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)

  9. 设置 SPYRE_IDS 变量:

    $ SPYRE_IDS="0381:50:00.0 0382:60:00.0 0383:70:00.0 0384:80:00.0"
  10. 启动 AI Inference Server 容器。例如,部署为实体提取服务配置的 granite-3.3-8b-instruct 模型:

    podman run \
        --device=/dev/vfio \
        -v $HOME/models:/models \
        -e AIU_PCIE_IDS="${SPYRE_IDS}" \
        -e VLLM_SPYRE_USE_CB=1 \
        --pids-limit 0 \
        --userns=keep-id \
        --group-add=keep-groups \
        --memory 200G \
        --shm-size 64G \
        -p 8000:8000 \
        registry.redhat.io/rhaiis/vllm-spyre:3.2.5 \
            --model /models/granite-3.3-8b-instruct \
            -tp 4 \
            --max-model-len 32768 \
            --max-num-seqs 32

验证

  • 在终端中的单独标签页中,使用 API 向模型发出请求。

    curl -X POST -H "Content-Type: application/json" -d '{
        "model": "/models/granite-3.3-8b-instruct"
        "prompt": "What is the capital of France?",
        "max_tokens": 50
    }' http://<your_server_ip>:8000/v1/completions | jq

    输出示例

    {
        "id": "cmpl-b94beda1d5a4485c9cb9ed4a13072fca",
        "object": "text_completion",
        "created": 1746555421,
        "choices": [
            {
                "index": 0,
                "text": " Paris.\nThe capital of France is Paris.",
                "logprobs": null,
                "finish_reason": "stop",
                "stop_reason": null,
                "prompt_logprobs": null
            }
        ],
        "usage": {
            "prompt_tokens": 8,
            "total_tokens": 18,
            "completion_tokens": 10,
            "prompt_tokens_details": null
        }
    }

以下示例描述了 IBM Spyre AI Accelerators 和 IBM Power 上的常见红帽 AI Inference 服务器工作负载。

实体提取

使用 lspci 命令的输出选择一个 Spyre 卡 ID,例如:

$ SPYRE_IDS="0381:50:00.0"

Podman 实体提取示例

$ podman run -d \
    --device=/dev/vfio \
    --name vllm-api \
    -v $HOME/models:/models:Z \
    -e VLLM_AIU_PCIE_IDS="$SPYRE_IDS" \
    -e VLLM_SPYRE_USE_CB=1 \
    --pids-limit 0 \
    --userns=keep-id \
    --group-add=keep-groups \
    --memory 100GB \
    --shm-size 64GB \
    -p 8000:8000 \
    registry.redhat.io/rhaiis/vllm-spyre:3.2.5 \
        --model /models/granite-3.3-8b-instruct \
        -tp 1 \
        --max-model-len 3072 \
        --max-num-seqs 16

RAG inference service

使用 lspci 命令的输出选择 4 个 Spyre 卡 ID,例如:

$ SPYRE_IDS="0381:50:00.0 0382:60:00.0 0383:70:00.0 0384:80:00.0"

podman RAG inference 服务示例

$ podman run -d \
    --device=/dev/vfio \
    --name vllm-api \
    -v $HOME/models:/models:Z \
    -e VLLM_AIU_PCIE_IDS="$SPYRE_IDS" \
    -e VLLM_MODEL_PATH=/models/granite-3.3-8b-instruct \
    -e VLLM_SPYRE_USE_CB=1 \
    --pids-limit 0 \
    --userns=keep-id \
    --group-add=keep-groups \
    --memory 200GB \
    --shm-size 64GB \
    -p 8000:8000 \
    registry.redhat.io/rhaiis/vllm-spyre:3.2.5 \
        --model /models/granite-3.3-8b-instruct \
        -tp 4 \
        --max-model-len 32768 \
        --max-num-seqs 32

RAG 嵌入

使用 lspci 命令的输出选择一个 Spyre 卡 ID,例如:

$ SPYRE_IDS="0384:80:00.0"

Podman RAG 嵌入 inference 服务示例

$ podman run -d \
    --device=/dev/vfio \
    --name vllm-api \
    -v $HOME/models:/models:Z \
    -e VLLM_AIU_PCIE_IDS="$SPYRE_IDS" \
    -e VLLM_MODEL_PATH=/models/granite-embedding-125m-english \
    -e VLLM_SPYRE_WARMUP_PROMPT_LENS=64 \
    -e VLLM_SPYRE_WARMUP_BATCH_SIZES=64 \
    --pids-limit 0 \
    --userns=keep-id \
    --group-add=keep-groups \
    --memory 200GB \
    --shm-size 64GB \
    -p 8000:8000 \
    registry.redhat.io/rhaiis/vllm-spyre:3.2.5 \
    --model /models/granite-embedding-125m-english \
    -tp 1

re-ranker inference service

使用 lspci 命令的输出选择一个 Spyre AI Accelerator 卡 ID,例如:

$ SPYRE_IDS="0384:80:00.0"

podman re-ranker inference 服务示例

$ podman run -d \
    --device=/dev/vfio \
    --name vllm-api \
    -v $HOME/models:/models:Z \
    -e VLLM_AIU_PCIE_IDS="$SPYRE_IDS" \
    -e VLLM_MODEL_PATH=/models/bge-reranker-v2-m3 \
    -e VLLM_SPYRE_WARMUP_PROMPT_LENS=1024 \
    -e VLLM_SPYRE_WARMUP_BATCH_SIZES=4 \
    --pids-limit 0 \
    --userns=keep-id \
    --group-add=keep-groups \
    --memory 200GB \
    --shm-size 64GB \
    -p 8000:8000 \
    registry.redhat.io/rhaiis/vllm-spyre:3.2.5 \
        --model /models/bge-reranker-v2-m3 \
        -tp 1

使用 Podman 和带有 IBM Spyre AI 加速器的 IBM Z 上运行的 Red Hat AI Inference Server 提供大型语言模型。

先决条件

  • 对于安装的 Z AI Accelerators,您可以访问运行带有 IBM Spyre 的 RHEL 9.6 的 IBM Z (s390x)服务器。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 已安装 Podman。
  • 您可以访问 registry.redhat.io 并已登录。
  • 您有一个 Hugging Face 帐户,并生成了一个 Hugging Face 访问令牌。
注意

IBM Spyre AI 加速器卡只支持 FP16 格式模型权重。对于兼容模型,Red Hat AI Inference Server inference 引擎在启动时自动将权重转换为 FP16。不需要额外的配置。

流程

  1. 在服务器主机上打开一个终端,并登录到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 运行以下命令拉取 Red Hat AI Inference Server 镜像:

    $ podman pull registry.redhat.io/rhaiis/vllm-spyre:3.2.5
  3. 如果您的系统启用了 SELinux,请将 SELinux 配置为允许设备访问:

    $ sudo setsebool -P container_use_devices 1
  4. 使用 lspci -v 验证容器是否可以访问主机系统 IBM Spyre AI Accelerators:

    $ podman run -it --rm --pull=newer \
        --security-opt=label=disable \
        --device=/dev/vfio \
        --group-add keep-groups \
        --entrypoint="lspci" \
        registry.redhat.io/rhaiis/vllm-spyre:3.2.5

    输出示例

    0381:50:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0382:60:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0383:70:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)
    0384:80:00.0 Processing accelerators: IBM Spyre Accelerator (rev 02)

  5. 创建卷以挂载到容器并调整容器权限,以便容器可以使用它。

    $ mkdir -p ~/models && chmod g+rwX ~/models
  6. granite-3.3-8b-instruct 模型下载到 models/ 文件夹中。如需更多信息,请参阅 下载模型
  7. 为可用的 Spyre 设备收集 IOMMU 组 ID:

    $ lspci

    输出示例

    0000:00:00.0 Processing accelerators: IBM Spyre Accelerator Virtual Function (rev 02)
    0001:00:00.0 Processing accelerators: IBM Spyre Accelerator Virtual Function (rev 02)
    0002:00:00.0 Processing accelerators: IBM Spyre Accelerator Virtual Function (rev ff)
    0003:00:00.0 Processing accelerators: IBM Spyre Accelerator Virtual Function (rev 02)

    每行都以 PCI 设备地址开头,例如 0000:00:00.0

  8. 使用 PCI 地址确定所需的 Spyre 卡的 IOMMU 组 ID,例如:

    $ readlink /sys/bus/pci/devices/<PCI_ADDRESS>/iommu_group

    输出示例

    ../../../kernel/iommu_groups/0

    IOMMU 组 ID (0)是 readlink 输出中末尾的数字。

    对每个必需的 Spyre 卡重复此操作。

  9. 使用 readlink 输出为所需的 Spyre 卡设置 IOMMU_GROUP_ID 变量。例如:

    IOMMU_GROUP_ID0=0
    IOMMU_GROUP_ID1=1
    IOMMU_GROUP_ID2=2
    IOMMU_GROUP_ID3=3
  10. 启动 AI Inference Server 容器,传递所需的 Spyre 设备的 IOMMU 组 ID 变量。例如,部署为实体提取在 4 个 Spyre 设备中提取的 granite-3.3-8b-instruct 模型:

    podman run \
      --device /dev/vfio/vfio \
      --device /dev/vfio/${IOMMU_GROUP_ID0}:/dev/vfio/${IOMMU_GROUP_ID0}  \
      --device /dev/vfio/${IOMMU_GROUP_ID1}:/dev/vfio/${IOMMU_GROUP_ID1}  \
      --device /dev/vfio/${IOMMU_GROUP_ID2}:/dev/vfio/${IOMMU_GROUP_ID2}  \
      --device /dev/vfio/${IOMMU_GROUP_ID3}:/dev/vfio/${IOMMU_GROUP_ID3}  \
      -v $HOME/models:/models:Z \
      --pids-limit 0 \
      --userns=keep-id \
      --group-add=keep-groups \
      --memory 200G \
      --shm-size 64G \
      -p 8000:8000 \
      registry.redhat.io/rhaiis/vllm-spyre:3.2.5 \
        --model /models/granite-3.3-8b-instruct \
        -tp 4 \
        --max-model-len 32768 \
        --max-num-seqs 32

验证

  • 在终端中的单独标签页中,使用 API 向模型发出请求。

    curl -X POST -H "Content-Type: application/json" -d '{
        "model": "/models/granite-3.3-8b-instruct",
        "prompt": "What is the capital of France?",
        "max_tokens": 50
    }' http://<your_server_ip>:8000/v1/completions | jq

    输出示例

    {
      "id": "cmpl-7c81cd00ccd04237ac8b5119e86b32a5",
      "object": "text_completion",
      "created": 1764665204,
      "model": "/models/granite-3.3-8b-instruct",
      "choices": [
        {
          "index": 0,
          "text": "\nThe answer is Paris. Paris is the capital and most populous city of France, located in the northern part of the country. It is renowned for its history, culture, fashion, and art, attracting",
          "logprobs": null,
          "finish_reason": "length",
          "stop_reason": null,
          "token_ids": null,
          "prompt_logprobs": null,
          "prompt_token_ids": null
        }
      ],
      "service_tier": null,
      "system_fingerprint": null,
      "usage": {
        "prompt_tokens": 7,
        "total_tokens": 57,
        "completion_tokens": 50,
        "prompt_tokens_details": null
      },
      "kv_transfer_params": null
    }

使用以下指标评估 AI Inference Server 提供的 LLM 模型的性能:

  • 第一次令牌(TTFT):当收到响应的第一个令牌时,请求发送到 的时间。
  • 每次输出令牌(TPOT) 时:第一个令牌后生成每个令牌的平均时间。
  • 延迟 :生成完整响应所需的总时间。
  • 吞吐量 :模型可在所有用户和请求的同时生成的输出令牌的总数。

完成以下步骤,运行一个基准测试,其中显示了 AI Inference Server 和其他 inference 服务器如何根据这些指标执行。

先决条件

  • AI Inference Server 容器镜像
  • GitHub 帐户
  • Python 3.9 或更高版本

流程

  1. 在您的主机系统上,启动一个 AI Inference Server 容器并提供模型。

    $ podman run --rm -it --device nvidia.com/gpu=all \
    --shm-size=4GB -p 8000:8000 \
    --env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
    --env "HF_HUB_OFFLINE=0" \
    -v ./rhaiis-cache:/opt/app-root/src/.cache \
    --security-opt=label=disable \
    registry.redhat.io/rhaiis/vllm-cuda-rhel9:3.2.5 \
    --model RedHatAI/Llama-3.2-1B-Instruct-FP8
  2. 在一个单独的终端选项卡中,安装基准工具依赖项。

    $ pip install vllm pandas datasets
  3. 克隆 vLLM Git 存储库

    $ git clone https://github.com/vllm-project/vllm.git
  4. 运行 ./vllm/benchmarks/benchmark_serving.py 脚本。

    $ python vllm/benchmarks/benchmark_serving.py --backend vllm --model RedHatAI/Llama-3.2-1B-Instruct-FP8 --num-prompts 100 --dataset-name random  --random-input 1024 --random-output 512 --port 8000

验证

结果显示 AI Inference 服务器如何根据密钥服务器指标执行:

============ Serving Benchmark Result ============
Successful requests:                    100
Benchmark duration (s):                 4.61
Total input tokens:                     102300
Total generated tokens:                 40493
Request throughput (req/s):             21.67
Output token throughput (tok/s):        8775.85
Total Token throughput (tok/s):         30946.83
---------------Time to First Token----------------
Mean TTFT (ms):                         193.61
Median TTFT (ms):                       193.82
P99 TTFT (ms):                          303.90
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                         9.06
Median TPOT (ms):                       8.57
P99 TPOT (ms):                          13.57
---------------Inter-token Latency----------------
Mean ITL (ms):                          8.54
Median ITL (ms):                        8.49
P99 ITL (ms):                           13.14
==================================================

尝试更改此基准的参数,然后再次运行它。注意如何将 vllm 作为后端与其他选项进行比较。吞吐量应该始终更高,但延迟应该较低。

  • 其它选项是: tgi,lmdeploy,deepspeed-mii,openai, 和 openai-chat
  • --dataset-name 的其它选项有: sharegpt,burstgpt,sonnet,random,hf

其他资源

第 10 章 故障排除

Red Hat AI Inference Server 3.2.5 的以下故障排除信息描述了与模型加载、内存、模型响应质量、网络和 GPU 驱动程序相关的常见问题。在可用的情况下,描述了常见问题的临时解决方案。

vLLM 中的大多数常见问题与安装、型号加载、内存管理和 GPU 通信相关。大多数问题可以通过使用正确配置的环境来解决,确保兼容硬件和软件版本,并遵循推荐的配置实践。

重要

对于持久问题,请导出 VLLM_LOGGING_LEVEL=DEBUG 以启用调试日志,然后检查日志。

$ export VLLM_LOGGING_LEVEL=DEBUG

10.1. 模型加载错误

  • 当您在没有指定用户命名空间的情况下运行 Red Hat AI Inference Server 容器镜像时,会返回一个未识别的模型错误。

    podman run --rm -it \
    --device nvidia.com/gpu=all \
    --security-opt=label=disable \
    --shm-size=4GB -p 8000:8000 \
    --env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
    --env "HF_HUB_OFFLINE=0" \
    -v ./rhaiis-cache:/opt/app-root/src/.cache \
    registry.redhat.io/rhaiis/vllm-cuda-rhel9:3.2.5 \
    --model RedHatAI/Llama-3.2-1B-Instruct-FP8

    输出示例

    ValueError: Unrecognized model in RedHatAI/Llama-3.2-1B-Instruct-FP8. Should have a model_type key in its config.json

    要解决这个问题,pass- userns=keep-id:uid=1001 作为第一个 Podman 参数,以确保容器以 root 用户身份运行。

    podman run --rm -it \
    --userns=keep-id:uid=1001 \
    --device nvidia.com/gpu=all \
    --security-opt=label=disable \
    --shm-size=4GB -p 8000:8000 \
    --env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
    --env "HF_HUB_OFFLINE=0" \
    -v ./rhaiis-cache:/opt/app-root/src/.cache \
    registry.redhat.io/rhaiis/vllm-cuda-rhel9:{rhaiis-version} \
    --model RedHatAI/Llama-3.2-1B-Instruct-FP8
  • 当 Red Hat AI Inference Server 下载模型时,下载会失败或卡住。为防止模型下载挂起,请先使用 huggingface-cli 下载模型。例如:

    $ huggingface-cli download <MODEL_ID> --local-dir <DOWNLOAD_PATH>

    在提供模型时,将本地模型路径传递给 vLLM,以防止再次下载模型。

  • 当 Red Hat AI Inference Server 从磁盘加载模型时,该过程有时会挂起。大型模型会消耗内存,如果内存运行较低,系统会因为它在 RAM 和磁盘之间进行交换数据而减慢。网络文件系统速度缓慢或缺少可用内存可能会触发过度交换。在集群节点之间共享文件系统的集群中会出现这种情况。

    在可能的情况下,将模型保存在本地磁盘中,以防止在模型加载过程中出现缓慢的问题。确定系统有足够的 CPU 内存。

    确定您的系统有足够的 CPU 容量来处理模型。

  • 有时,Red Hat AI Inference Server 无法检查模型。日志中会报告错误。例如:

    #...
      File "vllm/model_executor/models/registry.py", line xxx, in \_raise_for_unsupported
        raise ValueError(
    ValueError: Model architectures [''] failed to be inspected. Please check the logs for more details.

    当 vLLM 无法导入模型文件时,这个错误通常与 vLLM 构建中缺少依赖项或过时的二进制文件相关。

  • 不支持一些模型架构。请参阅验证的模型 列表。例如,以下错误表示您试图使用的模型不被支持:

    Traceback (most recent call last):
    #...
      File "vllm/model_executor/models/registry.py", line xxx, in inspect_model_cls
        for arch in architectures:
    TypeError: 'NoneType' object is not iterable
    #...
      File "vllm/model_executor/models/registry.py", line xxx, in \_raise_for_unsupported
        raise ValueError(
    ValueError: Model architectures [''] are not supported for now. Supported architectures:
    #...
    注意

    有些架构,如 DeepSeekV2VL 需要使用- hf_overrides 标志明确指定架构,例如:

    --hf_overrides '{\"architectures\": [\"DeepseekVLV2ForCausalLM\"]}
  • 当您加载 8 位浮点(FP8)模型时,某些硬件有时会发生运行时错误。FP8 需要 GPU 硬件加速。当您加载 FP8 模型(如 deepseek-r1 或带有 F8_E4M3 10sor 类型的型号)时会出现错误。例如:

    triton.compiler.errors.CompilationError: at 1:0:
    def \_per_token_group_quant_fp8(
    \^
    ValueError("type fp8e4nv not supported in this architecture. The supported fp8 dtypes are ('fp8e4b15', 'fp8e5')")
    [rank0]:[W502 11:12:56.323757996 ProcessGroupNCCL.cpp:1496] Warning: WARNING: destroy_process_group() was not called before program exit, which can leak resources. For more info, please see https://pytorch.org/docs/stable/distributed.html#shutdown (function operator())
    注意

    查看 Getting started 以确保支持您的特定加速器。目前支持的 FP8 模型支持的加速器包括:

  • 有时,当提供与主机系统相关的运行时错误时。例如,您可能会在日志中看到错误,如下所示:

    INFO 05-07 19:15:17 [config.py:1901] Chunked prefill is enabled with max_num_batched_tokens=2048.
    OMP: Error #179: Function Can't open SHM failed:
    OMP: System error #0: Success
    Traceback (most recent call last):
      File "/opt/app-root/bin/vllm", line 8, in <module>
        sys.exit(main())
    ..........................    raise RuntimeError("Engine core initialization failed. "
    RuntimeError: Engine core initialization failed. See root cause above.

    您可以在启动 vllm 时传递 --shm-size=2g 参数来解决这个问题。

10.2. 内存优化

  • 如果模型太大以使用单个 GPU 运行,则会出现内存不足(OOM)错误。使用内存优化选项,如 quantization, tensor parallelism, 或减少精度来减少内存消耗。如需更多信息,请参阅保留内存

10.3. 生成的模型响应质量

  • 在某些情况下,所生成的模型响应的质量可能会在更新后去除去。

    在新版本中更新了默认抽样参数源。对于 vLLM 版本 0.8.4 及更高版本,默认的抽样参数来自模型创建器提供的 generation_config.json 文件。在大多数情况下,这会导致更高的质量响应,因为模型创建者可能知道哪个抽样参数最适合其模型。然而,在某些情况下,模型创建者提供的默认值可能会导致性能下降。

    如果您遇到这个问题,请使用-- generation-config vllm 服务器参数使用旧默认值提供模型。

    重要

    如果应用 -generation-config vllm 服务器参数改进了模型输出,请继续使用 vLLM 默认值,并利用 Hugging Face 上的模型创建者更新其默认的 generation_config.json,以便生成更好的质量的生成。

10.4. CUDA 加速器错误

  • 使用 CUDA 加速器运行模型时,您可能会遇到 self.graph.replay () 错误。

    如果 vLLM 崩溃,且错误追踪捕获 vllm/worker/model_runner .py 模块中的 self.graph.replay () 方法的某种错误,则很可能是 CUDAGraph 类中出现的 CUDA 错误。

    要识别导致错误的特定 CUDA 操作,请将 --enforce-eager 服务器参数添加到 vllm 命令行,以禁用 CUDAGraph 优化并隔离有问题的 CUDA 操作。

  • 您可能会遇到由不正确的硬件或驱动程序设置导致的加速器和 CPU 通信问题。

    对于某些类型的 NVIDIA GPU,多 GPU 系统需要 NVIDIA Fabric Manager。nvidia-fabricmanager 软件包和相关 systemd 服务可能无法安装,或者软件包可能没有在运行。

    运行 诊断 Python 脚本,以检查 NVIDIA Collective Communications Library (NCCL)和 Gloo 库组件是否正确通信。

    在 NVIDIA 系统中,运行以下命令来检查光纤管理器状态:

    $ systemctl status nvidia-fabricmanager

    在成功配置的系统上,服务应处于活动状态并在运行且无错误。

  • 在 NVIDIA Multi -Instance GPU (MIG)硬件上运行带有十个并行性且将--tensor-parallel-size 设置为大于 1 的 vLLM 会导致在初始模型加载或形成检查阶段造成 AssertionError。这通常在启动 vLLM 时作为第一个错误之一。

10.5. 网络错误

  • 您可能会遇到复杂网络配置的网络错误。

    要排除网络问题,搜索列出不正确的 IP 地址的 DEBUG 语句的日志,例如:

    DEBUG 06-10 21:32:17 parallel_state.py:88] world_size=8 rank=0 local_rank=0 distributed_init_method=tcp://<incorrect_ip_address>:54641 backend=nccl

    要更正此问题,请使用 VLLM_HOST_IP 环境变量设置正确的 IP 地址,例如:

    $ export VLLM_HOST_IP=<correct_ip_address>

    指定与 NCCL 和 Gloo 的 IP 地址关联的网络接口:

    $ export NCCL_SOCKET_IFNAME=<your_network_interface>
    $ export GLOO_SOCKET_IFNAME=<your_network_interface>

10.6. Python 多处理错误

  • 您可能会遇到 Python 多处理警告或运行时错误。这可能是由没有为 Python 多处理正确构建的代码导致。以下是控制台警告示例:

    WARNING 12-11 14:50:37 multiproc_worker_utils.py:281] CUDA was previously
        initialized. We must use the `spawn` multiprocessing start method. Setting
        VLLM_WORKER_MULTIPROC_METHOD to 'spawn'.

    以下是 Python 运行时错误示例:

    RuntimeError:
            An attempt has been made to start a new process before the
            current process has finished its bootstrapping phase.
    
            This probably means that you are not using fork to start your
            child processes and you have forgotten to use the proper idiom
            in the main module:
    
                if __name__ = "__main__":
                    freeze_support()
                    ...
    
            The "freeze_support()" line can be omitted if the program
            is not going to be frozen to produce an executable.
    
            To fix this issue, refer to the "Safe importing of main module"
            section in https://docs.python.org/3/library/multiprocessing.html

    要解决运行时错误,请更新您的 Python 代码,以保护 if__name__ = "__main__": 块后面的 vllm 的使用,例如:

    if __name__ = "__main__":
        import vllm
    
        llm = vllm.LLM(...)

10.7. GPU 驱动程序或设备直通问题

  • 当您运行 Red Hat AI Inference Server 容器镜像时,有时不明确设备传递错误是由 GPU 驱动程序或工具(如 NVIDIA Container Toolkit )导致的。

    • 检查主机机器上安装的 NVIDIA Container 工具包是否可以看到主机 GPU:

      $ nvidia-ctk cdi list

      输出示例

      #...
      nvidia.com/gpu=GPU-0fe9bb20-207e-90bf-71a7-677e4627d9a1
      nvidia.com/gpu=GPU-10eff114-f824-a804-e7b7-e07e3f8ebc26
      nvidia.com/gpu=GPU-39af96b4-f115-9b6d-5be9-68af3abd0e52
      nvidia.com/gpu=GPU-3a711e90-a1c5-3d32-a2cd-0abeaa3df073
      nvidia.com/gpu=GPU-6f5f6d46-3fc1-8266-5baf-582a4de11937
      nvidia.com/gpu=GPU-da30e69a-7ba3-dc81-8a8b-e9b3c30aa593
      nvidia.com/gpu=GPU-dc3c1c36-841b-bb2e-4481-381f614e6667
      nvidia.com/gpu=GPU-e85ffe36-1642-47c2-644e-76f8a0f02ba7
      nvidia.com/gpu=all

    • 确保在主机上创建了 NVIDIA 加速器配置:

      $ sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
    • 运行以下命令,检查 Red Hat AI Inference Server 容器是否可以访问主机上的 NVIDIA GPU:

      $ podman run --rm -it --security-opt=label=disable --device nvidia.com/gpu=all nvcr.io/nvidia/cuda:12.4.1-base-ubi9 nvidia-smi

      输出示例

      +-----------------------------------------------------------------------------------------+
      | NVIDIA-SMI 570.124.06             Driver Version: 570.124.06     CUDA Version: 12.8     |
      |-----------------------------------------+------------------------+----------------------+
      | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
      | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
      |                                         |                        |               MIG M. |
      |=========================================+========================+======================|
      |   0  NVIDIA A100-SXM4-80GB          Off |   00000000:08:01.0 Off |                    0 |
      | N/A   32C    P0             64W /  400W |       1MiB /  81920MiB |      0%      Default |
      |                                         |                        |             Disabled |
      +-----------------------------------------+------------------------+----------------------+
      |   1  NVIDIA A100-SXM4-80GB          Off |   00000000:08:02.0 Off |                    0 |
      | N/A   29C    P0             63W /  400W |       1MiB /  81920MiB |      0%      Default |
      |                                         |                        |             Disabled |
      +-----------------------------------------+------------------------+----------------------+
      
      +-----------------------------------------------------------------------------------------+
      | Processes:                                                                              |
      |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
      |        ID   ID                                                               Usage      |
      |=========================================================================================|
      |  No running processes found                                                             |
      +-----------------------------------------------------------------------------------------+

10.8. IBM Power 问题故障排除

如果您无法访问 AI Inference Server 容器中的模型数据,请完成以下步骤:

  • 验证映射到容器的 /models 文件夹是否正确
  • 查看主机 SELinux 设置
  • 确保您已在 $HOME/models 文件夹上应用适当的权限,例如:

    $ chmod -R 755 $HOME/models
  • 确保为 Podman 卷挂载使用 :Z 选项:

    $ podman run -d --device=/dev/vfio \
         -v $HOME/models:/models:Z \
         # ...
  • 确保为解码模型设置了 VLLM_SPYRE_USE_CB=1

10.8.1. 用于 Power AI acclerator 卡问题的 IBM Spyre

  • 确保主机上可以看到 IBM Spyre AI 加速器卡。使用 lspci 验证卡是否可用。
  • 确保您的用户位于 sentient 组中。
  • 使用服务报告工具诊断和纠正卡访问问题。请参阅 IBM Power 系统服务及生产力工具

10.8.2. IBM Spyre 用于 Power 性能问题

  • 确保所有 Spyre 卡在 IBM Power 服务器 I/O drawer 的前四个插槽中安全隔离。前四个插槽具有最高的速度 PCIe 接口。
  • 确保分配给 LPAR 的卡都在同一个 drawer 中。不要将卡分开,因为这会增加 I/O 延迟。如需更多信息,请参阅 IBM Power11 文档
  • 如果您在 IBM Spyre AI Accelerator 卡时遇到问题,您可以使用 aiu-smi 工具以及您要配置集的工作负载。执行以下步骤:

    1. 启动模型。
    2. 从第二个终端中,查询模型。例如:

      $ curl http://127.0.0.1:8000/v1/completions -H "Content-Type: application/json" \
          -d '{ "model": "/models/granite-3.3-8b-instruct",
                "prompt": "Write me a long story about surfing dogs in Malibu.",
                "max_tokens": 8128,
                "temperature": 1,
                "n": 10
              }'
    3. 在第三个终端中,运行 aiu-smi 工具:

      $ podman exec -it <CONTAINER_ID> -c aiu-smi
    4. 或者,在正在运行的容器中执行 并运行 aiu-smi。例如:

      $ podman exec -it <CONTAINER_ID> bash

      在容器内运行 aiu-smi 工具:

      [senuser@689230aca2ba ~]$ aiu-smi

      aiu-smi 输出示例

      #MetricFiles
      # 0 /tmp/metrics.0181:50:00.0
      # 1 /tmp/metrics.0182:60:00.0
      # 2 /tmp/metrics.0183:70:00.0
      # 3 /tmp/metrics.0184:80:00.0
      #ID Date      Time      hostcpu hostmem    pwr  gtemp   busy    rdmem    wrmem    rxpci    txpci   rdrdma   wrrdma   rsvmem
      #   YYYYMMDD  HH:MM:SS        %       %      W      C      %     GB/s     GB/s     GB/s     GB/s     GB/s     GB/s       MB
        0 20251103  20:18:36    951.6    11.5   33.8   34.1     96   41.221    5.480    0.967    0.964    0.000    0.000    0.000
        1 20251103  20:18:36    951.6    11.5   30.6   33.0     96   41.201    5.464    0.967    0.964    0.000    0.000    0.000
        2 20251103  20:18:36    951.6    11.5   40.5   34.7     96   41.266    5.473    0.969    0.966    0.000    0.000    0.000
        3 20251103  20:18:36    951.6    11.5   37.3   39.2     96   41.358    5.484    0.971    0.968    0.000    0.000    0.000

使用您从 Red Hat AI Inference Server 容器运行的 vllm collect-env 命令来收集系统信息,以对 AI Inference Server 部署进行故障排除。此脚本收集系统详情、硬件配置和依赖项信息,以帮助诊断部署问题和模型干扰服务问题。

先决条件

  • 已安装 Podman 或 Docker。
  • 您以具有 sudo 访问权限的用户身份登录。
  • 您可以访问安装了数据中心等级 AI Accelerator 的 Linux 服务器。
  • 您已拉取并成功部署了 Red Hat AI Inference Server 容器。

流程

  1. 打开终端并登录到 registry.redhat.io

    $ podman login registry.redhat.io
  2. 为已安装的 AI 加速器拉取特定的 Red Hat AI Inference Server 容器镜像。例如,要拉取 Google Cloud TPU 的 Red Hat AI Inference Server 容器,请运行以下命令:

    $ podman pull registry.redhat.io/rhaiis/vllm-tpu-rhel9:3.2.5
  3. 在容器中运行 collect 环境脚本:

    $ podman run --rm -it \
      --name vllm-tpu \
      --network=host \
      --privileged \
      --device=/dev/vfio/vfio \
      --device=/dev/vfio/0 \
      -e PJRT_DEVICE=TPU \
      -e HF_HUB_OFFLINE=0 \
      -v ./.cache/rhaiis:/opt/app-root/src/.cache:Z \
      --entrypoint vllm collect-env \
      registry.redhat.io/rhaiis/vllm-tpu-rhel9:3.2.5

验证

vllm collect-env 命令输出详情环境信息,包括:

  • 系统硬件详情
  • 操作系统详情
  • Python 环境和依赖项
  • GPU/TPU 加速器信息

查看输出结果中可能指示配置问题的任何警告或错误。在向红帽支持报告问题时,包括您系统的 collect-env 输出。

Google Cloud TPU 报告示例如下:

==============================
        System Info
==============================
OS                           : Red Hat Enterprise Linux 9.6 (Plow) (x86_64)
GCC version                  : (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5)
Clang version                : Could not collect
CMake version                : version 4.1.0
Libc version                 : glibc-2.34

==============================
       PyTorch Info
==============================
PyTorch version              : 2.9.0.dev20250716
Is debug build               : False
CUDA used to build PyTorch   : None
ROCM used to build PyTorch   : N/A

==============================
      Python Environment
==============================
Python version               : 3.12.9 (main, Jun 20 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] (64-bit runtime)
Python platform              : Linux-6.8.0-1015-gcp-x86_64-with-glibc2.34

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : False
CUDA runtime version         : No CUDA
CUDA_MODULE_LOADING set to   : N/A
GPU models and configuration : No CUDA
Nvidia driver version        : No CUDA
cuDNN version                : No CUDA
HIP runtime version          : N/A
MIOpen runtime version       : N/A
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        52 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               44
On-line CPU(s) list:                  0-43
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 9B14
CPU family:                           25
Model:                                17
Thread(s) per core:                   2
Core(s) per socket:                   22
Socket(s):                            1
Stepping:                             1
BogoMIPS:                             5200.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext ssbd ibrs ibpb stibp vmmcall fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx512_bf16 clzero xsaveerptr wbnoinvd arat avx512vbmi umip avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            704 KiB (22 instances)
L1i cache:                            704 KiB (22 instances)
L2 cache:                             22 MiB (22 instances)
L3 cache:                             96 MiB (3 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-43
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Mitigation; Safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Retpolines; IBPB conditional; IBRS_FW; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] numpy==1.26.4
[pip3] pyzmq==27.0.1
[pip3] torch==2.9.0.dev20250716
[pip3] torch-xla==2.9.0.dev20250716
[pip3] torchvision==0.24.0.dev20250716
[pip3] transformers==4.55.2
[pip3] triton==3.3.1
[conda] Could not collect

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
Neuron SDK Version           : N/A
vLLM Version                 : 0.10.0+rhai1
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
  Could not collect

==============================
     Environment Variables
==============================
VLLM_USE_V1=1
VLLM_WORKER_MULTIPROC_METHOD=spawn
VLLM_NO_USAGE_STATS=1
NCCL_CUMEM_ENABLE=0
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_default

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部