miniconda安装
参考文章:Ubuntu系统上快速安装Miniconda的步骤_ubuntu 安装miniconda
下载最新版Miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
给下载的文件添加可执行权限:
chmod +x Miniconda3-latest-Linux-x86_64.sh
运行安装文件:
./Miniconda3-latest-Linux-x86_64.sh
验证是否安装成功:
conda --version
更新conda到最新版本:
conda update conda
虚拟环境搭建
创建虚拟环境
conda create -n env_name python=X.XX
conda create -n myPytorch python=3.12
虚拟环境创建成功之后,进行包的安装
- torch安装,选择安装的是cuda12.8的版本
进入torch官网:
点击进入torch官网
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

- 安装transformers、modelscope等包
pip install transformers peft accelerate
pip install modelscope
- 安装vllm:GPU - vLLM
首先安装uv:pip install uv
然后安装vllm:uv pip install vllm --torch-backend=auto
官网参考:
You can install vLLM using eitherpiporuv pip:# Install vLLM with CUDA 12.8. # If you are using pip. pip install vllm --extra-index-url https://download.pytorch.org/whl/cu128 # If you are using uv. uv pip install vllm --torch-backend=autoWe recommend leveraging
uvto automatically select the appropriate PyTorch index at runtime by inspecting the installed CUDA driver version via--torch-backend=auto(orUV_TORCH_BACKEND=auto). To select a specific backend (e.g.,cu126), set--torch-backend=cu126(orUV_TORCH_BACKEND=cu126). If this doesn't work, try runninguv self updateto updateuvfirst.
- 最终安装的核心包的版本如下:
torch 2.7.1+cu128
torchaudio 2.7.1+cu128
torchvision 0.22.1+cu128
transformers 4.54.0
vllm 0.10.0
peft 0.16.0
accelerate 1.9.0
modelscope 1.28.1
155

被折叠的 条评论
为什么被折叠?



