linux centos SadTalker使用指南,超级详细

发布时间 2023-07-26 17:51:23作者: cn三少

1.主要按照官方文档操作即可

1.1首先安装安装 anaconda

1.1.1下载anaconda

官网地址:Free Download | Anaconda

 

wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh


 

 

1.1.2安装

sh Anaconda3-2023.03-1-Linux-x86_64.sh

 

直接默认安装即可

 

安装后一定要重新打开shell窗口

 

1.2安装python(不需要)

擦考链接::Python安装 linux_linux安装python_码农弓长先生的博客-CSDN博客

 

 

1.3安装git

yum -y install git 

 

 

1.4下载源码

git clone https://github.com/OpenTalker/SadTalker

 

1.5参考SanTalker继续安装

git clone https://github.com/Winfredy/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

### tts is optional for gradio demo. 
### pip install TTS

 

2.如果没有显卡,则只用cpu

vim /opt/anaconda3/envs/sadtalker/lib/python3.8/site-packages/facexlib/alignment/__init__.py


目录和使用的python环境有关,如果创建环境用的python是3.10
则需要修改的文件是


vim /opt/anaconda3/lib/python3.10/site-packages/facexlib/alignment/__init__.py
#其中 ',"cpu"'为添加的内容
model.load_state_dict(torch.load(model_path,"cpu")['state_dict'], strict=True)

 

 

3.具体使用教程示例

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

 

 

默认生成的文件在results目录下

 

 

4.常见报错解决方案

4.1

libGL.so.1: cannot open shared object file: No such file or directory

 

pip install opencv-python-headless

参考:【解决方法】libGL.so.1: cannot open shared object file: No such file or directory_MrNeoJeep的博客-CSDN博客 

 

 

 

 

5.coda下载慢解决方案

conda 速度慢 解决方案_conda下载慢_一颗小树x的博客-CSDN博客

 

 

6.pip安装慢解决方案

一次使用: pip install you_package_name -i https://pypi.tuna.tsinghua.edu.cn/simple(清华源) 

一劳永逸 :pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple(清华源)