如何在 Linux 中将 Dell Pro Max 16 Plus MB16250 上带有 Qualcomm 推理卡的 Open WebUI 与 vLLM 配合使用
Summary: 了解如何使用在 AI100 推理卡上运行的 vLLM 为 LLM 提供服务,然后使用 Open WebUI 与模型聊天。
Instructions
前提条件
完成一次性设备设置 :如何在 Linux 中设置带有 Qualcomm 推理卡的 Dell Pro Max 16 Plus。
必须传递 Huffingface 令牌 (HF_TOKEN) 才能使用此模型。首先,登录 Huggingface (如果您没有免费帐户,请创建一个免费帐户)。然后,您必须在 模型链接中接受模型使用条款。
您的模型访问审批需要 5-10 分钟,并且您会收到一封电子邮件确认。完成此操作后,接下来创建一个令牌。从 Huggingface。
- 单击Huggingface网站右上角的 个人资料图标 。
- 从下拉菜单中,选择 Settings。
- 在左侧导航面板中,单击 Access Tokens。
- 单击 + Create new token 按钮。
- 提供令牌 的名称 (例如,“my-hf-token”)。
- 选择 Read 按钮(请勿选择Fine-grained或Write按钮)。
- 单击 Create token 按钮。
- 此时将显示令牌值。立即复制此值 并将其保存在安全位置,因为一旦您离开页面,它将不会再次显示。
现在,在 Ubuntu 终端中,使用 huggingface-cli 登录输入令牌,该令牌允许您使用 Huggingface 中的 Llama-3.2-1B-Instruct 模型。如果您没有安装 huggingface-cli,则可能需要使用 pip install huggingface-hub。输出示例。
my-hf-token HF_TOKEN的示例使用
dell@dell:~$ huggingface-cli login
⚠️ Warning: 'huggingface-cli login' is deprecated. Use 'hf auth login' instead.
_| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|
_| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|
_| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|
_| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|
A token is already saved on your machine. Run `hf auth whoami` to get more information or `hf auth logout` if you want to log out.
Setting a new token will erase the existing one.
To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Enter your token (input will not be visible):
Add token as git credential? (Y/n) y
Token is valid (permission: read).
The token `my-hf-token` has been saved to /home/dell/.cache/huggingface/stored_tokens
Your token has been saved in your configured git credential helpers (store).
Your token has been saved to /home/dell/.cache/huggingface/token
Login successful.
The current active token is: `my-hf-token`
dell@dell:~$ HF_TOKEN=<INSERT YOUR TOKEN HERE>
下载 Llama 3.2:1B Instruct 预构建的 QPC
在本行动手册中,我们将使用面向云 AI 加速器的 Llama 3.2:1B Instruct-Zentree-Qualcinn 预编译模型目录的预构建 QPC。警告:这是一个不安全的链接,使用风险自负。
请按照以下步骤从存档中下载并解压 QPC。AI100 推理卡最多使用两个 SoC(片上系统),因此我们使用 Zentree 下载链接地址下载该特定的预构建版本。如果您尚未安装 curl,则可以使用以下命令在终端中安装它: sudo apt install curl。
# Use existing Downloads folder for model downloads
cd ~/Downloads
# Download QPC archive from Zentree as llama3.2-1b-instruct.tar.gz
curl -fSL https://dc00tk1pxen80.cloudfront.net/SDK1.20.4/meta-llama/Llama-3.2-1B-Instruct/Llama-3.2-1B-Instruct_qpc_16cores_128pl_8192cl_1fbs_2devices_mxfp6_mxint8.tar.gz -o llama3.2-1b-instruct.tar.gz
# Extract QPC archive
tar -xzvf llama3.2-1b-instruct.tar.gz
# Rename extracted directory to llama3.2-1b-instruct-qpc
mv $(tar -tzf llama3.2-1b-instruct.tar.gz | head -1 | cut -f1 -d"/") llama3.2-1b-instruct-qpc
使用 vLLM 服务于 Llama 3.2:1B Instruct 模型
打开终端并运行以下命令。
-v ~/Downloads/llama3.2-1b-instruct-qpc:/root/qpc行映射到 QPC 下载目录,从步骤 下载 Llama 3.2:1B 指示预构建的 QPC 第 2 部分:下载 Llama 3.2:1B Instruct 预构建的 QPC。- HF_TOKEN必须按照步骤 Prequesites 第 1 部分中的设置才能传递到容器中
- 要服务的模型是
meta-llama/Llama-3.2-1B-Instruct来自 Llama 3.2:1B Instruct-Zentree-Qualcinn Cloud AI Accelerators预编译模型目录。警告:这是一个不安全的链接,使用风险自负。
max-num-seq是来自 Llama 3.2:1B Instruct-Zentree-Qualcinn Cloud AI Accelerators预编译模型目录的一个完整批次大小。警告:这是一个不安全的链接,使用风险自负。
max-model-len是 8192,来自 Llama 3.2:1B Instruct-Zentree-Qualcinn Precompiled Model Catalog for Cloud AI Accelerators上的上下文长度 (CL)。警告:这是一个不安全的链接,使用风险自负。
max-seq_len-to-captureis 128 from Chunking Prompt Length from Llama 3.2:1B Instruct-Zentree-Qualcinn Precompiled Model Catalog for Cloud AI Accelerators.警告:这是一个不安全的链接,使用风险自负。
如果您以前没有使用过此版本的 AI100 Docker 容器,它会在打开 Docker 容器之前获取 ~14GB。在打开 Docker 容器之前,请确保已设置HF_TOKEN。
docker run --rm -it \
--name qaic-bench \
--device=/dev/accel/accel1 \
--device=/dev/accel/accel2 \
--network host \
--ulimit nofile=1048576 \
-e OMP_NUM_THREADS=8 \
-e HF_TOKEN=$HF_TOKEN \
-v ~/Downloads/llama3.2-1b-instruct-qpc:/root/qpc \
ghcr.io/quic/cloud_ai_inference_ubuntu24:1.20.6.0 \
/opt/vllm-env/bin/vllm serve meta-llama/Llama-3.2-1B-Instruct \
--max-num-seq 1 \
--max-model-len 8192 \
--max-seq_len-to-capture 128 \
--device qaic \
--device-group 0,1 \
--quantization mxfp6 \
--kv-cache-dtype mxint8 \
--override-qaic-config "qpc_path=/root/qpc/qpc"
一旦您看到消息“应用程序启动完成”,模型就已准备好进行推理。
meta-llama/Llama-3.2-1B-Instruct 受到限制。您必须有权访问它并通过身份验证才能访问它。请登录。
要停止 vLLM(卸载模型并关闭容器),请在此终端窗口中按 Ctrl+C。较大的型号可能需要长达 1 分钟才能卸载。
参考资料:Docker - 高通®云AI SDK用户指南 和 vLLM - 高通®云 AI SDK 用户指南
启动 Open WebUI 容器
打开新终端并运行以下命令。
docker run -d \
-p 3000:8080 \
-e WEBUI_AUTH=False \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui \
ghcr.io/open-webui/open-webui:main-slim
如果您之前未下载过 Open WebUI,这将获取容器。~20 秒后,可通过以下链接在网页浏览器中打开 WebUI: http://localhost:3000/
http://localhost:3000/
容器将继续在后台运行,直到您停止容器。在终端中使用以下命令可停止、重新启动或更新容器。
要停止容器,请执行以下操作: docker rm -f open-webui
要重新启动现有容器,请执行以下操作: docker start open-webui
要更新容器,请执行以下操作: docker pull ghcr.io/open-webui/open-webui:main-slim
配置 Open WebUI
使用浏览器访问以下链接 http://localhost:3000/admin/settings/connections
- 添加 OpenAI API 连接 - 在管理 OpenAI API 连接行中,按右侧连接类型的 +。
- 将“Connection Type”切换为“Local”。
- 将 URL 设置为
http://host.docker.internal:8000/v1 - 按“保存”。
使用 Open WebUI
使用浏览器连接到此链接 http://localhost:3000/ 并开始聊天,Open WebUI 会自动检测模型。您可以使用 vLLM 保持容器处于活动状态并更改正在运行的模型,或者使用以下命令停止容器 第 4 节:启动 Open WebUI 容器。
参考:首页 |打开 WebUI