Windows部署GeneFace++实操指南
一 环境准备
nvidia-smi(查看驱动与CUDA运行时)、nvcc --version(查看Toolkit版本)。二 获取源码与安装依赖
python -m venv geneface_env && geneface_env\Scripts\activateconda create -n geneface python=3.9 -y && conda activate genefacepip install -r requirements.txtpip install numpy opencv-python torch torchvisionpip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118(示例为CUDA 11.8)。三 编译与安装
mkdir build && cd build
cmake .. -G "Visual Studio 16 2019" -A x64 -DPYTHON_EXECUTABLE=path\to\python.exe
cmake --build . --config Releasepip install . 或 python setup.py install四 运行与验证
python main.pypython webui.py,控制台会输出类似“Running on local URL: http://0.0.0.0:8080”的提示,浏览器访问即可。import torch
print("CUDA available:", torch.cuda.is_available())
print("CUDA device count:", torch.cuda.device_count())五 常见问题与快速排障
nvidia-smi与nvcc --version输出;确认PyTorch为GPU版且CUDA版本一致;在代码中显式指定device:torch.device("cuda" if torch.cuda.is_available() else "cpu")。