1.安装anaconda,Python and git
此处不是重点,参考站内其他文章即可
2.下载文件和环境
git clone https://github.com/OpenTalker/SadTalker.git
cd SadTalker
conda create -n sadtalker python=3.8
conda activate sadtalker
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
conda install ffmpeg
pip install -r requirements.txt
### Coqui TTS is optional for gradio demo.
### pip install TTS
安装官方链接一步步操作即可
3.安装对应的模型
保证自己在sadtalker的路径下,输入 bash scripts/download_models.sh
4.运行
python inference.py --driven_audio /opt/source-code/SadTalker/examples/driven_audio/bus_chinese.wav --source_image /opt/source-code/SadTalker/examples/source_image/full_body_1.png --enhancer gfpgan --preprocess full --still
5.常见bug
1.环境下载时出现无对应版本的软件包
ERROR: Could not find a version that satisfies the requirement tb-nightly (from basicsr) (from versions: none) ERROR: No matching distribution found for tb-nightly
方法:添加下载源,加入阿里源,腾讯源,清华源
2.加载模型时出现问题,主要是因为网络问题中断下载,导致模型只下载了一部分,可以注意自己的模型大小。
safetensors_rust.SafetensorError: Error while deserializing header: MetadataIncompleteBuffer
方法:删除下载好的模型,重新运行命令