本地LLM相關~[04]在LINUX使用VLLM正確載入Qwen3.6-35B-A3B-NVFP4大模型 並且使用CURL進行測試

本地LLM相關~[04]在LINUX使用VLLM正確載入Qwen3.6-35B-A3B-NVFP4大模型 並且使用CURL進行測試

本地LLM相關~[04]在LINUX使用VLLM正確載入Qwen3.6-35B-A3B-NVFP4大模型 並且使用CURL進行測試


資料來源:

https://grok.com/share/bGVnYWN5LWNvcHk_5f80d261-56fd-46c9-a345-d908cd880081
https://www.perplexity.ai/search/c94ce41e-5f29-41f0-be5c-37928954f3ff
https://share.gemini.google/NCgB58WDdTlx
https://chatgpt.com/share/6a51fdd9-9d98-83e8-bfb5-a28195ad85b8


#建立大模型專屬資料夾                        

sudo mkdir -p /data/models
sudo chown altos:users /data/models
    sudo chown $USER:$USER /data/models #$USER:$USER [擁有者和群組 ; groups可以查詢帳號本身所在群組]


#下載大模型

source .venv/bin/activate

hf download Qwen/Qwen3.6-35B-A3B \
    --local-dir /data/models/Qwen/Qwen3.6-35B-A3B

hf download Qwen/Qwen3.6-35B-A3B-FP8 \
    --local-dir /data/models/Qwen/Qwen3.6-35B-A3B-FP8
    
hf download nvidia/Qwen3.6-35B-A3B-NVFP4 \
    --local-dir /data/models/Qwen/Qwen3.6-35B-A3B-NVFP4

deactivate #離開語法


#先更新系統:

sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y


#確認版本

uname -a
    Linux gn100-d4d6 6.17.0-1026-nvidia #26-Ubuntu SMP PREEMPT_DYNAMIC Thu Jun 25 00:57:17 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux

cat /etc/os-release
    PRETTY_NAME="Ubuntu 24.04.4 LTS"
    NAME="Ubuntu"
    VERSION_ID="24.04"
    VERSION="24.04.4 LTS (Noble Numbat)"
    VERSION_CODENAME=noble
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=noble
    LOGO=ubuntu-logo


#確認 GPU

nvidia-smi
    Tue Jul 14 08:57:24 2026       
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 580.159.03             Driver Version: 580.159.03     CUDA Version: 13.0     |
    +-----------------------------------------+------------------------+----------------------+
    | 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 GB10                    On  |   0000000F:01:00.0  On |                  N/A |
    | N/A   38C    P0              5W /  N/A  | Not Supported          |      2%      Default |
    |                                         |                        |                  N/A |
    +-----------------------------------------+------------------------+----------------------+

    +-----------------------------------------------------------------------------------------+
    | Processes:                                                                              |
    |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
    |        ID   ID                                                               Usage      |
    |=========================================================================================|
    |    0   N/A  N/A           34457      G   /usr/lib/xorg/Xorg                      117MiB |
    |    0   N/A  N/A           34653      G   /usr/bin/gnome-shell                    176MiB |
    |    0   N/A  N/A           35337      G   /usr/bin/gnome-text-editor               39MiB |
    |    0   N/A  N/A           40407      G   .../8593/usr/lib/firefox/firefox        223MiB |
    +-----------------------------------------------------------------------------------------+


#安裝 Docker

curl -fsSL https://get.docker.com | sudo sh #判斷是否以安裝 docker --version


#加入Docker權限

sudo usermod -aG docker altos #sudo usermod -aG docker $USER


#Altos aiGeni安裝說明 [Altos-aiGeni_Installation-Guide_ZH_1_01_0010-arm64.pdf]

cd /home/altos/Desktop/Altos_aigeni_installer_1.01.0010-arm64.run
bash altos_aigeni_installer_1.01.0010-arm64.run


#安裝 NVIDIA Container Toolkit [ nvidia-ctk –version #檢查是否以安裝]

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor \
-o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg #加入套件來源
curl -s -L \
https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list #加入套件來源

sudo apt update

sudo apt install -y nvidia-container-toolkit


#設定 Docker 和 NVIDIA Container Toolkit 綁定

sudo nvidia-ctk runtime configure --runtime=docker
重開機


#安裝 Docker Compose ~ Docker 官方提供的一個工具,用於定義和執行多容器的 Docker 應用程式。只需透過一個名為 compose.yaml 的 YAML 設定檔,即可集中配置所有應用程式所需的服務、網路與資料卷,並使用單一指令同時啟動或停止所有容器。

docker compose version #確定是否以安裝
    Docker Compose version v5.0.2
#安裝 Docker Compose ~ sudo apt install docker-compose-plugin


#建立Docker專屬資料夾 [/opt/ai-stack -> /data]

#sudo mkdir -p /data/models
#sudo chown altos:users /data/models
sudo chown altos:users /data/models/Qwen
sudo chown altos:users /data

sudo mkdir -p /data/{cache,logs,config,scripts}
sudo chown altos:users /data/cache
sudo chown altos:users /data/logs
sudo chown altos:users /data/config
sudo chown altos:users /data/scripts

sudo mkdir -p /data/cache/{huggingface,pip}
sudo chown altos:users /data/cache/huggingface
sudo chown altos:users /data/cache/pip

sudo mkdir -p /data/logs/vllm
sudo chown altos:users /data/logs/vllm


#建立 docker-compose.yml

nano /data/docker-compose.yml #nano /opt/ai-stack/docker-compose.yml
services:
  vllm-qwen:
    image: vllm/vllm-openai:latest-aarch64  # 保留您原本完美運作的 ARM 專用映像檔
    container_name: vllm-qwen
    restart: unless-stopped
    ipc: host
    ports:
      - "8000:8000"
    volumes:
      # ⚠️ 請確保左邊的「主機路徑」對應您下載 NVFP4 模型的實際路徑
      - /data/models/Qwen/Qwen3.6-35B-A3B-NVFP4:/model
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    environment:
      - FORCE_CUDA=1
      - PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
      # ⚠️ 徹底關閉 PyTorch 慢速編譯(維持您的完美設定)
      - VLLM_TORCH_COMPILE_LEVEL=0
    command: >
      --model /model
      --served-model-name Qwen3.6-35B-FP4
      --api-key "MySecretKey_123456"
      --gpu-memory-utilization 0.70
      --max-model-len 65536
      --trust-remote-code
      --quantization modelopt
      --max-num-seqs 64
      --max-num-batched-tokens 2048
      --kv-cache-dtype fp8
      --enforce-eager


# 在與 docker-compose.yml 相同的目錄下建立 .env

nano .env
# =========================================================================
# vLLM 基礎路徑設定
# =========================================================================

# Hugging Face 快取目錄路徑(若有需要從線上拉取權重時會用到)
HF_HOME=/data/cache/huggingface

# 主機上存放模型的主目錄路徑
MODEL_DIR=/data/models

# 日誌輸出目錄
LOG_DIR=/data/logs

# =========================================================================
# 模型指定(指向容器內部的對應路徑)
# =========================================================================
# 說明:
# 主機的 /data/models/Qwen/Qwen3.6-35B-A3B
# 對應到容器內就是 /models/Qwen/Qwen3.6-35B-A3B
MODEL_NAME=/models/Qwen/Qwen3.6-35B-A3B


#釋放系統 Cache 記憶體(最快、最推薦)

sudo sync && sudo sysctl -w vm.drop_caches=3
free -h


#擴大置換空間(Swap

# 關閉舊的 swap
sudo swapoff -a

# 建立一個 64GB 的 swap 空間
sudo dd if=/dev/zero of=/swapfile bs=1G count=64
sudo chmod 600 /swapfile
sudo mkswap /swapfile

# 啟用新的 swap
sudo swapon /swapfile


#啟動 vLLM

cd /data
docker compose up -d #啟動
docker logs -f vllm-qwen #查看日誌
    #INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
    #只有當你看到日誌出現以下這一行,才代表成功,這時才能開另一個終端機去跑 curl 測試:
docker compose down #停止


#CURL測試

curl http://localhost:8000/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer MySecretKey_123456"   -d '{ 
    "model": "Qwen3.6-35B",
    "messages": [
      {"role": "user", "content": "你好!請用繁體中文自我介紹,並說說你對 這台搭 載 NVIDIA Grace Blackwell 晶片的工作站有何看法?"}
    ],
    "temperature": 0.7
  }'
{"error":{"message":"The model `Qwen3.6-35B` does not exist.","type":"NotFoundError","param":"model","code":404}}

~~~~~~~~~~~~~~~~~
curl http://localhost:8000/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer MySecretKey_123456"   -d '{ 
    "model": "Qwen3.6-35B-FP4",
    "messages": [
      {"role": "user", "content": "你好!請用繁體中文自我介紹"}
    ],
    "temperature": 0.7
  }'


curl http://localhost:8000/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer MySecretKey_123456"   -d '{ 
    "model": "Qwen3.6-35B-FP4",
    "messages": [
      {"role": "user", "content": "這台搭 載  處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)晶片的工作站建置vLLM提供給hermes agent有何看法?"}
    ],
    "temperature": 0.7
  }'

#限制回覆字數為150字避免長篇大論等太久
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer MySecretKey_123456" \
  -d '{ 
    "model": "Qwen3.6-35B-FP4",
    "messages": [
      {"role": "user", "content": "這台搭載處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)晶片的工作站建置vLLM提供給hermes agent有何看法?"}
    ],
    "temperature": 0.7,
    "max_tokens": 150
  }'  

#使用curl+python3 實現能像 ChatGPT 網頁那樣平滑地、一字字吐出乾淨的中文,你可以配合 python 或 jq 工具來過濾。
curl -s -N http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer MySecretKey_123456" \
  -d '{  
    "model": "Qwen3.6-35B-FP4", 
    "messages": [ 
      {"role": "system", "content": "你是一位精通 AI 硬體與 Agent 架構的資深架構師。請一律使用「繁體中文(台灣)」為使用者解答,並保持專業與親切。"},
      {"role": "user", "content": "這台搭載處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)晶片的工作站建置vLLM提供給hermes agent有何看法?"} 
    ], 
    "temperature": 0.7, 
    "stream": true
  }' | python3 -c "
import sys, json
for line in sys.stdin:
    line = line.strip()
    if line.startswith('data: '):
        data_str = line[6:]
        if data_str == '[DONE]':
            break
        try:
            data = json.loads(data_str)
            content = data['choices'][0]['delta'].get('content', '')
            print(content, end='', flush=True)
        except Exception:
            pass
"

PS.截至目前為止完整的測試記錄檔(gb10系統調校紀錄.txt)

PW:Altosgb10f1

sudo apt update
sudo apt upgrade -y

#UBUNTU 安裝中文輸入法 [Ubuntu 安裝中文輸入法 Fcitx5] ~ https://share.gemini.google/jphfbxWLp0lo
sudo apt update
sudo apt install -y fcitx5 fcitx5-configtool fcitx5-chinese-addons fcitx5-chewing fcitx5-frontend-all

im-config -n fcitx5

重開機

#安裝完整 Python3 環境
sudo apt install -y \
python3 \
python3-dev \
python3-pip \
python3-venv \
python3-setuptools \
python3-wheel \
python3-full

#安裝常用開發工具
sudo apt install -y \
build-essential \
cmake \
git \
curl \
wget \
unzip \
zip \
pkg-config

#SSL 與憑證
sudo apt install -y \
ca-certificates \
openssl

#壓縮工具
sudo apt install -y \
pigz \
xz-utils \
p7zip-full

#系統監控
sudo apt install -y \
htop \
iotop \
nvtop \
tree \
jq

#安裝大語言模型下載器
python3 -m venv .venv

source .venv/bin/activate

pip install huggingface_hub #核心

hf --version

deactivate #離開語法

#建立大模型專屬資料夾                        
sudo mkdir -p /data/models
sudo chown altos:users /data/models
    sudo chown $USER:$USER /data/models #$USER:$USER [擁有者和群組 ; groups可以查詢帳號本身所在群組]

#下載大模型
source .venv/bin/activate

hf download Qwen/Qwen3.6-35B-A3B \
    --local-dir /data/models/Qwen/Qwen3.6-35B-A3B

hf download Qwen/Qwen3.6-35B-A3B-FP8 \
    --local-dir /data/models/Qwen/Qwen3.6-35B-A3B-FP8
    
hf download nvidia/Qwen3.6-35B-A3B-NVFP4 \
    --local-dir /data/models/Qwen/Qwen3.6-35B-A3B-NVFP4

deactivate #離開語法

==============

我要用下列 硬體規格 
●主機主要規格
.品牌:Acer Altos
.型號:Altos BrainSphere™ GB10 F1工作站
.主機板晶片組:-
.處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)
.CUDA☆ Cores:6144
.Tensor Core:第五代
.RT Core:第四代
.Tensor 效能:1 PetaFLOP AI 運算效能*
*使用稀疏性( sparsity )功能時的理論峰值效能為 4 PFLOPS。
.記憶體容量:128GB LPDDR5x 統一系統記憶體
.固態硬碟:4TB NVMe M.2 具有自加密功能
.圖形處理器(GPU):NVIDIA Grace Blackwell
.作業系統:NVIDIA DGX™ OS
.主機型態:工作站/迷你電腦

我要如何安裝DOCKER建立日後好維護的vLLM環境 把完整流程和指令整理出來

https://grok.com/share/bGVnYWN5LWNvcHk_5f80d261-56fd-46c9-a345-d908cd880081
https://www.perplexity.ai/search/c94ce41e-5f29-41f0-be5c-37928954f3ff
https://share.gemini.google/NCgB58WDdTlx
https://chatgpt.com/share/6a51fdd9-9d98-83e8-bfb5-a28195ad85b8


#先更新系統:
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y

#確認版本
uname -a
    Linux gn100-d4d6 6.17.0-1026-nvidia #26-Ubuntu SMP PREEMPT_DYNAMIC Thu Jun 25 00:57:17 UTC 2026 aarch64 aarch64 aarch64 GNU/Linux

cat /etc/os-release
    PRETTY_NAME="Ubuntu 24.04.4 LTS"
    NAME="Ubuntu"
    VERSION_ID="24.04"
    VERSION="24.04.4 LTS (Noble Numbat)"
    VERSION_CODENAME=noble
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=noble
    LOGO=ubuntu-logo

#確認 GPU
nvidia-smi
    Tue Jul 14 08:57:24 2026       
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 580.159.03             Driver Version: 580.159.03     CUDA Version: 13.0     |
    +-----------------------------------------+------------------------+----------------------+
    | 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 GB10                    On  |   0000000F:01:00.0  On |                  N/A |
    | N/A   38C    P0              5W /  N/A  | Not Supported          |      2%      Default |
    |                                         |                        |                  N/A |
    +-----------------------------------------+------------------------+----------------------+

    +-----------------------------------------------------------------------------------------+
    | Processes:                                                                              |
    |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
    |        ID   ID                                                               Usage      |
    |=========================================================================================|
    |    0   N/A  N/A           34457      G   /usr/lib/xorg/Xorg                      117MiB |
    |    0   N/A  N/A           34653      G   /usr/bin/gnome-shell                    176MiB |
    |    0   N/A  N/A           35337      G   /usr/bin/gnome-text-editor               39MiB |
    |    0   N/A  N/A           40407      G   .../8593/usr/lib/firefox/firefox        223MiB |
    +-----------------------------------------------------------------------------------------+

#安裝 Docker
curl -fsSL https://get.docker.com | sudo sh #判斷是否以安裝 docker --version

#加入Docker權限
sudo usermod -aG docker altos #sudo usermod -aG docker $USER

#Altos aiGeni安裝說明 [Altos-aiGeni_Installation-Guide_ZH_1_01_0010-arm64.pdf]
cd /home/altos/Desktop/Altos_aigeni_installer_1.01.0010-arm64.run
bash altos_aigeni_installer_1.01.0010-arm64.run

#安裝 NVIDIA Container Toolkit [ nvidia-ctk --version #檢查是否以安裝]
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor \
-o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg #加入套件來源
curl -s -L \
https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list #加入套件來源

sudo apt update

sudo apt install -y nvidia-container-toolkit

#設定 Docker 和 NVIDIA Container Toolkit 綁定
sudo nvidia-ctk runtime configure --runtime=docker
重開機

#安裝 Docker Compose ~ Docker 官方提供的一個工具,用於定義和執行多容器的 Docker 應用程式。只需透過一個名為 compose.yaml 的 YAML 設定檔,即可集中配置所有應用程式所需的服務、網路與資料卷,並使用單一指令同時啟動或停止所有容器。
docker compose version #確定是否以安裝
    Docker Compose version v5.0.2
#安裝 Docker Compose ~ sudo apt install docker-compose-plugin

#建立Docker專屬資料夾 [/opt/ai-stack -> /data]                        
#sudo mkdir -p /data/models
#sudo chown altos:users /data/models
sudo chown altos:users /data/models/Qwen
sudo chown altos:users /data

sudo mkdir -p /data/{cache,logs,config,scripts}
sudo chown altos:users /data/cache
sudo chown altos:users /data/logs
sudo chown altos:users /data/config
sudo chown altos:users /data/scripts

sudo mkdir -p /data/cache/{huggingface,pip}
sudo chown altos:users /data/cache/huggingface
sudo chown altos:users /data/cache/pip

sudo mkdir -p /data/logs/vllm
sudo chown altos:users /data/logs/vllm

#建立 docker-compose.yml
nano /data/docker-compose.yml #nano /opt/ai-stack/docker-compose.yml
services:
  vllm-qwen:
    image: vllm/vllm-openai:latest-aarch64  # 保留您原本完美運作的 ARM 專用映像檔
    container_name: vllm-qwen
    restart: unless-stopped
    ipc: host
    ports:
      - "8000:8000"
    volumes:
      # ⚠️ 請確保左邊的「主機路徑」對應您下載 NVFP4 模型的實際路徑
      - /data/models/Qwen/Qwen3.6-35B-A3B-NVFP4:/model
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    environment:
      - FORCE_CUDA=1
      - PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
      # ⚠️ 徹底關閉 PyTorch 慢速編譯(維持您的完美設定)
      - VLLM_TORCH_COMPILE_LEVEL=0
    command: >
      --model /model
      --served-model-name Qwen3.6-35B-FP4
      --api-key "MySecretKey_123456"
      --gpu-memory-utilization 0.70
      --max-model-len 65536
      --trust-remote-code
      --quantization modelopt
      --max-num-seqs 64
      --max-num-batched-tokens 2048
      --kv-cache-dtype fp8
      --enforce-eager

# 在與 docker-compose.yml 相同的目錄下建立 .env
nano .env
# =========================================================================
# vLLM 基礎路徑設定
# =========================================================================

# Hugging Face 快取目錄路徑(若有需要從線上拉取權重時會用到)
HF_HOME=/data/cache/huggingface

# 主機上存放模型的主目錄路徑
MODEL_DIR=/data/models

# 日誌輸出目錄
LOG_DIR=/data/logs

# =========================================================================
# 模型指定(指向容器內部的對應路徑)
# =========================================================================
# 說明:
# 主機的 /data/models/Qwen/Qwen3.6-35B-A3B
# 對應到容器內就是 /models/Qwen/Qwen3.6-35B-A3B
MODEL_NAME=/models/Qwen/Qwen3.6-35B-A3B

#釋放系統 Cache 記憶體(最快、最推薦)
sudo sync && sudo sysctl -w vm.drop_caches=3
free -h

#擴大置換空間(Swap
# 關閉舊的 swap
sudo swapoff -a

# 建立一個 64GB 的 swap 空間
sudo dd if=/dev/zero of=/swapfile bs=1G count=64
sudo chmod 600 /swapfile
sudo mkswap /swapfile

# 啟用新的 swap
sudo swapon /swapfile


#啟動 vLLM
cd /data
docker compose up -d #啟動
docker logs -f vllm-qwen #查看日誌
    #INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
    #只有當你看到日誌出現以下這一行,才代表成功,這時才能開另一個終端機去跑 curl 測試:
docker compose down #停止

#CURL測試
curl http://localhost:8000/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer MySecretKey_123456"   -d '{ 
    "model": "Qwen3.6-35B",
    "messages": [
      {"role": "user", "content": "你好!請用繁體中文自我介紹,並說說你對 這台搭 載 NVIDIA Grace Blackwell 晶片的工作站有何看法?"}
    ],
    "temperature": 0.7
  }'
{"error":{"message":"The model `Qwen3.6-35B` does not exist.","type":"NotFoundError","param":"model","code":404}}

~~~~~~~~~~~~~~~~~
curl http://localhost:8000/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer MySecretKey_123456"   -d '{ 
    "model": "Qwen3.6-35B-FP4",
    "messages": [
      {"role": "user", "content": "你好!請用繁體中文自我介紹"}
    ],
    "temperature": 0.7
  }'


curl http://localhost:8000/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer MySecretKey_123456"   -d '{ 
    "model": "Qwen3.6-35B-FP4",
    "messages": [
      {"role": "user", "content": "這台搭 載  處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)晶片的工作站建置vLLM提供給hermes agent有何看法?"}
    ],
    "temperature": 0.7
  }'

#限制回覆字數為150字避免長篇大論等太久
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer MySecretKey_123456" \
  -d '{ 
    "model": "Qwen3.6-35B-FP4",
    "messages": [
      {"role": "user", "content": "這台搭載處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)晶片的工作站建置vLLM提供給hermes agent有何看法?"}
    ],
    "temperature": 0.7,
    "max_tokens": 150
  }'  

#使用curl+python3 實現能像 ChatGPT 網頁那樣平滑地、一字字吐出乾淨的中文,你可以配合 python 或 jq 工具來過濾。
curl -s -N http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer MySecretKey_123456" \
  -d '{  
    "model": "Qwen3.6-35B-FP4", 
    "messages": [ 
      {"role": "system", "content": "你是一位精通 AI 硬體與 Agent 架構的資深架構師。請一律使用「繁體中文(台灣)」為使用者解答,並保持專業與親切。"},
      {"role": "user", "content": "這台搭載處理器:Arm 20 核心(10× Cortex-X925 + 10× Cortex-A725)晶片的工作站建置vLLM提供給hermes agent有何看法?"} 
    ], 
    "temperature": 0.7, 
    "stream": true
  }' | python3 -c "
import sys, json
for line in sys.stdin:
    line = line.strip()
    if line.startswith('data: '):
        data_str = line[6:]
        if data_str == '[DONE]':
            break
        try:
            data = json.loads(data_str)
            content = data['choices'][0]['delta'].get('content', '')
            print(content, end='', flush=True)
        except Exception:
            pass
"

One thought on “本地LLM相關~[04]在LINUX使用VLLM正確載入Qwen3.6-35B-A3B-NVFP4大模型 並且使用CURL進行測試

  1. WINDOWS 使用CURL 測試響應速度BAT

    REM WINDOWS TEST LiteLLM+VLLM response time
    REM Best time: 3sec
    date /t
    echo 目前時間:%TIME:~0,12%

    curl http://192.168.1.30:4000/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer sk-master-key-1234567890" -d "{\"model\": \"Qwen3.6-35B-FP4\", \"messages\": [{\"role\": \"user\", \"content\": \"HELLO\"}], \"temperature\": 0.7}"

    echo 目前時間:%TIME:~0,12%
    pause

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *