CUDA安装教程
CUDA 安装
1 | 检查 NVIDIA 驱动是否正常工作 |
PyTorch 安装
1 | 自动安装 PyTorch |
Anaconda3安装
登录23服务器
docker exec id /bin/bash
sudo wget https://repo.continuum.io/archive/Anaconda3-2022.10-Linux-x86_64.sh
sudo sh Anaconda3-2022.10-Linux-x86_64.sh
sudo vim ~/.bashrc
将最后一行加上
export PATH=$PATH:/data/young/anaconda3/bin
source ~/.bashrc
conda -V
更新apt
sudo apt-get update
sudo apt-get install gcc
服务部署和调用
安装vllm
pip install vllm
安装git lfs
wget https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh
bash script.deb.sh
apt-get install git-lfs
下载模型
git lfs https://hf-mirror.com/Qwen/Qwen1.5-14B-Chat
重命名模型
1 | import os |
服务启动
bug1:
Total number of attention heads (40) must be divisible by tensor parallel size (7)
bug2:
ValueError: Bfloat16 is only supported on GPUs with compute capability of at least 8.0. Your NVIDIA GeForce RTX 2080 Ti GPU has compute capability 7.5. You can use float16 instead by explicitly setting thedtype flag in CLI, for example: –dtype=half.
bug3:
ValueError: The model’s max seq len (32768) is larger than the maximum number of tokens that can be stored in KV cache (3200). Try increasing gpu_memory_utilization or decreasing max_model_len when initializing the engine.
1 | CUDA_VISIBLE_DEVICES=0,1,2,3 python -m vllm.entrypoints.openai.api_server --served-model-name Qwen1.5-14B-Chat --model /mnt/young/models/Qwen1.5-14B-Chat/ --tensor-parallel-size 4 --dtype float16 --max-model-len 4096 |
服务调用
postman调用
1 | curl --location 'http://10.39.101.123:8000/v1/chat/completions' \ |
python调用
1 | import requests |

