Wan2.2 中文文档 下载 App

本地部署 Wan2.2:克隆仓库、安装依赖和 FlashAttention

前置条件

在开始之前,需要确认你的环境满足以下基本要求:

克隆仓库

官方仓库托管在 GitHub:

git clone https://github.com/Wan-Video/Wan2.2.git
cd Wan2.2

仓库内容包含:

安装依赖

基础依赖:

pip install -r requirements.txt

如果要用 CosyVoice 做 S2V 的 TTS 语音合成(可选):

pip install -r requirements_s2v.txt

FlashAttention 安装技巧

FlashAttention 3 是性能关键,但安装经常失败。官方文档给的建议是:

如果 flash_attn 安装失败,先安装其他所有包,最后再单独安装 flash_attn。

FlashAttention 3 支持 Hopper 架构(H100),Ampere 架构(A100 / 4090)用 FlashAttention 2 也可以。如果安装持续失败,可以尝试:

  1. 确认 CUDA 与 PyTorch 版本匹配(nvidia-smi 查看驱动,torch.cuda.is_available() 验证)
  2. 升级到最新的 pip、setuptools 和 wheel
  3. 如果编译报错,看看是否缺少编译工具(Linux 上 build-essential,Windows 上 Visual Studio C++ Build Tools)

验证环境

安装完成后,简单的烟雾测试:

python -c "import torch; print(f'PyTorch {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}'); print(f'GPU count: {torch.cuda.device_count()}')"

输出应显示 PyTorch ≥ 2.4.0,CUDA 可用,GPU 数量正确。

下一步

环境搭好之后,还需要下载模型权重。根据你想用的模型,在 HuggingFace 或 ModelScope 上下载对应的 checkpoint。模型下载的具体命令和渠道见 模型下载。