CentOS 上 GeneFace++ 安装详解
一 环境准备与版本选择
nvidia-smi 可见)。gcc/g++、make、cmake、git 可用;后续若涉及人脸相关依赖(如 dlib/face_recognition),通常需要 GCC ≥ 9 与 CMake ≥ 3.17。二 系统依赖与编译工具安装
sudo yum groupinstall -y "Development Tools";sudo yum install -y epel-release cmake3 git wget unzip htopcmake3 -> cmake 软链:sudo ln -sfn /usr/bin/cmake3 /usr/bin/cmakesudo yum install -y centos-release-sclsudo yum install -y devtoolset-9-gcc*scl enable devtoolset-9 bash(或写入 ~/.bashrc 的 source /opt/rh/devtoolset-9/enable)gcc -v、g++ -v 应显示 9.x三 Python 与 PyTorch 环境
conda create -n genefacepp python=3.9 -yconda activate genefacepppip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118pip install torch torchvision torchaudiopython -c "import torch; print(torch.__version__, torch.cuda.is_available())"四 GeneFace++ 源码获取与安装
git clone https://github.com/yerfor/GeneFacePlusPlus.gitcd GeneFacePlusPlusrequirements.txt:pip install -r requirements.txtopencv-python、matplotlib、tqdm、scipy、numpy 等缺失项,按提示补装data/raw/videos/.mp4 python data_gen/utils/process_video/extract_segment_imgs.py --ds_name=nerf --vid_dir=data/raw/videos/.mp4 --force_single_process CUDA_VISIBLE_DEVICES=0 python tasks/run.py --config=egs/datasets//lm3d_radnerf_sr.yaml --exp_name=motion2video_nerf/_head --reset CUDA_VISIBLE_DEVICES=0 python tasks/run.py --config=egs/datasets//lm3d_radnerf_torso_sr.yaml --exp_name=motion2video_nerf/_torso --hparams=head_model_dir=checkpoints/motion2video_nerf/_head --reset CUDA_VISIBLE_DEVICES=0 python inference/app_genefacepp.py --a2m_ckpt=checkpoints/audio2motion_vae --head_ckpt= --torso_ckpt=motion2video_nerf/_torso egs/datasets//lm3d_radnerf_*.yaml 中将 eye_blink_dim 调整为 4。blink_encoder):检查配置与训练/推理时使用的模型版本一致,特别是 eye_blink_dim 等参数。五 常见问题与排障要点
scl enable devtoolset-9 bash 后再编译。nvidia-smi 与 torch.version.cuda 不一致,需安装与 PyTorch 匹配的 CUDA/cuDNN,或重装对应版本的 PyTorch。--low_mem 等低内存选项;必要时增加系统交换分区。eye_blink_dim 等参数,需同步到所有相关 yaml 文件。