CentOS下怎么配置GeneFace Plus Plus

AI技术
小华
2026-09-01

下面给你一份在 CentOS 下配置 GeneFace++(GeneFace Plus Plus)的实战向指南,覆盖系统依赖、Python 环境、模型权重、推理/训练常见坑点。CentOS 与 Ubuntu 不同,主要在编译依赖和驱动上要注意。

一、系统与环境准备(CentOS 7/8 通用建议)

1. 系统更新

sudo yum update -y

2. 安装基础编译工具

sudo yum groupinstall "Development Tools" -y
sudo yum install -y \
git wget unzip cmake \
ffmpeg ffmpeg-devel \
mesa-libGL mesa-libGLU
⚠️ CentOS 默认 ffmpeg 可能版本旧,建议用 rpmfusion 或手动编译新版

二、Python 环境(强烈推荐 Conda)

1. 安装 Miniconda

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

2. 创建环境

conda create -n geneface python=3.9 -y
conda activate geneface

三、克隆 GeneFace++ 仓库

git clone https://github.com/wellesley-geography/GeneFacePlusPlus.git
cd GeneFacePlusPlus

四、安装 PyTorch(CentOS + GPU)

1. 查看 CUDA 驱动

nvidia-smi

2. 安装对应 PyTorch(示例 CUDA 11.8)

pip install torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu118

五、安装项目依赖

pip install -r requirements.txt

常见 CentOS 问题修复

❌ 缺少 pthreads

sudo yum install -y glibc-static

face_alignment 编译失败

conda install -c conda-forge dlib

六、下载模型权重(必须)

GeneFace++ 需要以下模型:

  • hubert
  • audio2motion
  • motion2video
  • face_recon

示例:

bash scripts/download_pretrained.sh

或手动从 HuggingFace / 官方说明下载到:

checkpoints/

七、准备输入数据

data/
├── audio.wav
├── ref_image.png
└── pose_video.mp4

八、推理示例(生成说话人脸)

python inference.py \
--audio data/audio.wav \
--image data/ref_image.png \
--pose data/pose_video.mp4 \
--out output.mp4

九、训练(可选)

python train.py --config configs/train.yaml

注意:

  • CentOS 下 NUMA / 多卡 需要 export NCCL_P2P_DISABLE=1
  • 日志建议使用 tmux

十、CentOS 常见坑总结

问题解决
GLIBC 版本低用 conda 环境
ffmpeg 不支持编译或 rpmfusion
CUDA 不识别重装驱动 + 设 PATH
中文路径全部英文路径

十一、推荐配置(稳定)

  • CentOS 7.9 / 8 Stream
  • Python 3.9
  • CUDA 11.8
  • PyTorch 2.0+

如果你愿意,我可以:
✅ 给你一份 CentOS 一键安装脚本
✅ 帮你 解决具体报错日志
✅ 教你 只用 CPU 跑轻量版
直接把你的 CentOS 版本和报错贴出来即可。

亿速云提供售前/售后服务

售前业务咨询

售后技术保障

400-100-2938

7*24小时售后电话

官方微信小程序