Mac SD-WebUi中安装使用SadTalker及报错解决办法
安装
1、在扩展插件中找到SadTalker 或通过从网址安装https://github.com/OpenTalker/SadTalker
2、下载readmore提供的模型文件放入SadTalker目录下
使用
参数说明
- upload image 上传一张图片
- upload or tts 上传语音文件
- pose style 选择视频人物的姿势,姿势变化种类
- face model resolution 分辨率:视频分辨率
- preprocess 图片处理方法,包括crop/resize/full/extcrop/extfull
1 | crop 从图片中截取头部做视频 |
- still mode 减少头部运动,负面效果就是头不怎么动了
- batch size in generation 同时处理数,越大处理越快但也费显存(看gpu能力,若能力有限参数影响不大)
- if GFPGAN 修脸,基于gfpgan对视频进行增强
报错
numpy相关
SadTalker module ‘numpy’ has no attribute ‘complex’.
找到引发错误的
constantq.py
文件/Users/nanbowan/stable-diffusion-webui/venv/lib/python3.10/site-packages/librosa/core/constantq.py
备份该文件,然后打开它进行编辑。
找到使用
np.complex
的代码行:
1 | dtype=np.complex, |
- 将
np.complex
替换为np.complex128
或 Python 内置的complex
类型。由于这里涉及到 NumPy 数组,建议使用np.complex128
以保持一致性:
1 | dtype=np.complex128, |
- 保存文件并退出编辑器。
- 重新启动你的应用程序或脚本,
ffmpeg或ffprobe报错
Please install ffmpeg
in your system to use non-WAV audio file formats and make sure ffprobe
is in your PATH.
- 下载ffmpeg和ffprobe
- 添加
ffmpeg
到PATH
: 如果ffmpeg
可以被执行,但是系统无法找到ffprobe
,可能是因为ffprobe
不在PATH
中。你需要将ffmpeg
和ffprobe的目录添加到PATH
环境变量中。如果是zsh
使用open -e ~/.zshrc
;如果使用的是bash
使用open -e ~/.bash_profile
,在你的.zshrc
或.bash_profile
文件中添加以下行
1 | # 替换自己的目录 |
为了让更改立即生效,你需要重新加载配置文件。你可以通过在终端中运行以下命令来实现,如果是 zsh
使用source ~/.zshrc
,如果使用的是 bash
使用source ~/.bash_profile
numpy+float相关
AttributeError: module numpy
has no attribute float
. np.float
was a deprecated alias for the builtin float
. To avoid this error in existing code, use float
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64
here.
找到银发错误的文件 ../stable-diffusion-webui/extensions/SadTalker/src/face3d/util/my_awing_arch.py和preprocess.py
1
2
3
4
5
6
7# my_awing_arch.py文件:
将 preds = preds.astype(np.float, copy=False)
修改为 preds = preds.astype(float, copy=False)
# preprocess.py文件:
将 trans_params = np.array([w0, h0, s, t[0], t[1]])
修改为 trans_params = np.array([w0, h0, s, t[0][0], t[1][0]])另外一个错误文件
/Users/nanbowan/stable-diffusion-webui/venv/lib/python3.10/site-packages/librosa/util/utils.py
将1
2
3
4
5mapping = {
np.dtype(np.float32): np.complex64,
np.dtype(np.float64): np.complex128,
np.dtype(np.float): np.complex,
}
替换为1
2
3
4mapping = {
np.dtype(np.float32): np.complex64,
np.dtype(float): np.complex128, # 使用 Python 内置的 float 类型
}
- 感谢你赐予我前进的力量