OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
11.59k stars 2.16k forks source link

Apple M1安装错误集合和解决方法 #832

Open Danny0802 opened 5 months ago

Danny0802 commented 5 months ago

记录一下在M1安装本项目遇到的一些问题和解决方案

  1. 环境 建议用Python3.10,低于3.10的版本在安装TTS时会报错,这个是TTS的错误

2、安装包列表。改动点是指定了gradio版本号, numpy==1.23.4 face_alignment==1.3.5 imageio==2.19.3 imageio-ffmpeg==0.4.7 librosa==0.9.2 # numba resampy==0.3.1 pydub==0.25.1 scipy kornia==0.6.8 tqdm yacs==0.1.8 pyyaml joblib==1.1.0 scikit-image==0.19.3 basicsr==1.4.2 facexlib==0.3.0 gradio==3.50.0 gfpgan av dlib safetensors

3、错误集合 3.1、ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor‘ 解决办法: 进入 vim /Users/dannyxch/anaconda3/envs/sadtalker/lib/python3.10/site-packages/basicsr/data/degradations.py 把下面这一行 from torchvision.transforms.functional_tensor import rgb_to_grayscale 修改为 from torchvision.transforms._functional_tensor import rgb_to_grayscale

3.2、with gr.Row().style(equal_height=False): AttributeError: 'Row' object has no attribute 'style' 产生原因:gradio版本太高 解决办法:pip install gradio==3.50.0

3.3、from TTS.api import TTS ModuleNotFoundError: No module named 'TTS' 产生原因:没有安装TTS 解决办法:pip install TTS 注意,要在Python3.10环境下安装

3.4、File "/Users/dannyxch/PycharmProjects/SadTalker/app_sadtalker.py", line 108, in demo = sadtalker_demo() File "/Users/dannyxch/PycharmProjects/SadTalker/app_sadtalker.py", line 50, in sadtalker_demo tts_talker = TTSTalker() File "/Users/dannyxch/PycharmProjects/SadTalker/src/utils/text2speech.py", line 8, in init model_name = TTS().list_models()[0] TypeError: 'ModelManager' object is not subscriptable 产生原因 :TTS包问题 解决办法:进入TTS->api.py文件,把下面这一行 return ModelManager(models_file=TTS.get_models_file_path(), progress_bar=False, verbose=False) 修改为 return ModelManager(models_file=TTS.get_models_file_path(), progress_bar=False, verbose=False).list_models()

3.5、多个libavdevice.xx.xx.xx版本问题 产生原因:环境中有多个libavdevice版本,系统不知道用哪一个 解决办法:删除lib目录下的版本,具体路径如下(根据你自己的实际路径删除) /anaconda3/envs/sadtalker/lib

3.6、运行程序时提示RuntimeError: unexpected EOF, expected 541345 more bytes. The file might be corrupted. 产生原因:模型文件没有下载完整 解决办法:对比一下checkpoint、gfpgan目录下的文件大小,是否和下面的截图一致。如果大小不一致,重新下载有差异的安装包即可。具体的下载路径在scripts/download_models.sh

image image

3.7、 File "charset_normalizer/md.py", line 5, in ImportError: cannot import name 'COMMON_SAFE_ASCII_CHARACTERS' from 'charset_normalizer.constant' (/Users/dannyxch/anaconda3/envs/sadtalker/lib/python3.10/site-packages/charset_normalizer/constant.py) 解决办法:pip install chardet

3.8、关于ffmpeg报错 使用ffmpeg,直接在Mac系统上用brew install ffmpeg安装即可,conda环境中不用安装。如果conda环境中安装了ffmpeg,建议最好删除,要不然会有多个ffmpeg,会出现各种乱七八糟的错误

1171000410 commented 5 months ago

你好,请问下用Python3.10之后,安装的TTS版本是0.22.0吗? 我这里TTS==0.22.0要求对应的torch>=2.1,这样的torch版本源代码就跑不了了。 辛苦看下您的TTS版本和torch版本,感谢!

Danny0802 commented 5 months ago

你好,请问下用Python3.10之后,安装的TTS版本是0.22.0吗? 我这里TTS==0.22.0要求对应的torch>=2.1,这样的torch版本源代码就跑不了了。 辛苦看下您的TTS版本和torch版本,感谢!

我这里完整的安装包版本如下: Package Version


absl-py 2.1.0 addict 2.4.0 aiofiles 23.2.1 aiohttp 3.9.3 aiosignal 1.3.1 altair 5.2.0 annotated-types 0.6.0 anyascii 0.3.2 anyio 4.3.0 async-timeout 4.0.3 attrs 23.2.0 audioread 3.0.1 av 11.0.0 Babel 2.14.0 bangla 0.0.2 basicsr 1.4.2 blinker 1.7.0 blis 0.7.11 bnnumerizer 0.0.2 bnunicodenormalizer 0.1.6 catalogue 2.0.10 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 cloudpathlib 0.16.0 confection 0.1.4 contourpy 1.2.0 coqpit 0.0.17 cycler 0.12.1 cymem 2.0.8 Cython 3.0.9 dateparser 1.1.8 decorator 5.1.1 dlib 19.24.2 docopt 0.6.2 einops 0.7.0 encodec 0.1.1 exceptiongroup 1.2.0 face-alignment 1.3.5 facexlib 0.3.0 fastapi 0.110.0 ffmpy 0.3.2 filelock 3.13.1 filterpy 1.4.5 Flask 3.0.2 fonttools 4.50.0 frozenlist 1.4.1 fsspec 2024.3.0 future 1.0.0 g2pkk 0.1.2 gfpgan 1.3.8 gradio 3.50.0 gradio_client 0.6.1 grpcio 1.62.1 gruut 2.2.3 gruut-ipa 0.13.0 gruut-lang-de 2.0.0 gruut-lang-en 2.0.0 gruut-lang-es 2.0.0 gruut-lang-fr 2.0.2 h11 0.14.0 hangul-romanize 0.1.0 httpcore 1.0.4 httpx 0.27.0 huggingface-hub 0.21.4 idna 3.6 imageio 2.19.3 imageio-ffmpeg 0.4.7 importlib_metadata 7.0.2 importlib_resources 6.3.1 inflect 7.0.0 itsdangerous 2.1.2 jamo 0.4.1 jieba 0.42.1 Jinja2 3.1.3 joblib 1.3.2 jsonlines 1.2.0 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 kiwisolver 1.4.5 kornia 0.6.8 langcodes 3.3.0 lazy_loader 0.3 librosa 0.10.0 llvmlite 0.42.0 lmdb 1.4.1 Markdown 3.6 MarkupSafe 2.1.5 matplotlib 3.8.3 mpmath 1.3.0 msgpack 1.0.8 multidict 6.0.5 murmurhash 1.0.10 networkx 2.8.8 nltk 3.8.1 num2words 0.5.13 numba 0.59.0 numpy 1.22.0 opencv-python 4.9.0.80 orjson 3.9.15 packaging 24.0 pandas 1.5.3 pillow 10.2.0 pip 23.3.1 platformdirs 4.2.0 pooch 1.8.1 preshed 3.0.9 protobuf 5.26.0 psutil 5.9.8 pycparser 2.21 pydantic 2.6.4 pydantic_core 2.16.3 pydub 0.25.1 pynndescent 0.5.11 pyparsing 3.1.2 pypinyin 0.51.0 pysbd 0.3.4 python-crfsuite 0.9.10 python-dateutil 2.9.0.post0 python-multipart 0.0.9 pytz 2024.1 PyWavelets 1.5.0 PyYAML 6.0.1 referencing 0.34.0 regex 2023.12.25 requests 2.31.0 resampy 0.3.1 rpds-py 0.18.0 safetensors 0.4.2 scikit-image 0.19.3 scikit-learn 1.4.1.post1 scipy 1.11.4 semantic-version 2.10.0 setuptools 68.2.2 six 1.16.0 smart-open 6.4.0 sniffio 1.3.1 soundfile 0.12.1 soxr 0.3.7 spacy 3.7.4 spacy-legacy 3.0.12 spacy-loggers 1.0.5 srsly 2.4.8 starlette 0.36.3 SudachiDict-core 20240109 SudachiPy 0.6.8 sympy 1.12 tb-nightly 2.17.0a20240317 tensorboard 2.16.2 tensorboard-data-server 0.7.2 thinc 8.2.3 threadpoolctl 3.3.0 tifffile 2024.2.12 tokenizers 0.15.2 tomli 2.0.1 toolz 0.12.1 torch 2.2.1 torchaudio 2.2.1 torchvision 0.17.1 tqdm 4.66.2 trainer 0.0.36 transformers 4.38.2 TTS 0.22.0 typer 0.9.0 typing_extensions 4.10.0 tzdata 2024.1 tzlocal 5.2 umap-learn 0.5.5 Unidecode 1.3.8 urllib3 2.2.1 uvicorn 0.28.0 wasabi 1.1.2 weasel 0.3.4 websockets 11.0.3 Werkzeug 3.0.1 wheel 0.41.2 yacs 0.1.8 yapf 0.40.2 yarl 1.9.4 zipp 3.18.1

LeoWood commented 5 months ago

补充一条,basicsr==1.4.2 pip源设定为清华可能报错,改成阿里源(https://mirrors.aliyun.com/pypi/simple)成功安装

jackytu256 commented 5 months ago

I occur the "envs/sadtalker/lib/python3.10/site-packages/pycrfsuite/_pycrfsuite.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))" issue and fixed by using this command "arch -arm64 python3 -m pip install python-crfsuite"

jimmyken commented 4 months ago

pip install TTS遇到错误: TTS/tts/utils/monotonic_align/core.c:765:10: fatal error: 'numpy/arrayobject.h' file not found

include "numpy/arrayobject.h"

           ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for TTS Failed to build TTS ERROR: Could not build wheels for TTS, which is required to install pyproject.toml-based projects (py-3-10-11)

是找不到numpy头文件, 修复方法: export CFLAGS="-I/Users/apple/anaconda3/envs/py-3-10-11/lib/python3.10/site-packages/numpy/core/include/ $CFLAGS"

需要根据当前环境修改实际路径。关键是site-packages/numpy/core/include/。

LeoWood commented 4 months ago

您的邮件已收到,我将尽快回复,谢谢。刘欢

moluuser commented 4 months ago

Mac运行起来太不容易了。。。不知道这是Apple Silicon的坑还是Python的坑。。。

luckytalk commented 3 months ago

项目运行起来后,生成测试视频错误,报错torch,可能是PyTorch 和 torchvision 的版本不兼容 RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.version and your torchvision version with torchvision.version and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.

LeoWood commented 3 months ago

您的邮件已收到,我将尽快回复,谢谢。刘欢

luckytalk commented 3 months ago

谢谢,拜托

在 2024-05-31 09:58:06,"LeoWood" @.***> 写道:

您的邮件已收到,我将尽快回复,谢谢。刘欢

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

luckytalk commented 3 months ago

PyTorch 和 torchvision 的版本不兼容的问题已解决。安装与torch匹配的torchvision即可(0.18.0)

luckytalk commented 3 months ago

现在遇到新的问题,在页面上使用tts合成语音时报错: 'TTS' object has no attribute 'speakers'

luckytalk commented 3 months ago

PyTorch 和 torchvision 的版本不兼容的问题已解决。安装与torch匹配的torchvision即可(0.18.0)

现在遇到新的问题,在页面上使用tts合成语音时报错: 'TTS' object has no attribute 'speakers'

在 2024-05-31 09:58:06,"LeoWood" @.***> 写道:

您的邮件已收到,我将尽快回复,谢谢。刘欢

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

luckytalk commented 2 months ago

另外请教一下,怎样在模型中调用“参考视频”?我看到在huggingface上是可以调用参考视频的?

在 2024-05-31 09:58:06,"LeoWood" @.***> 写道:

您的邮件已收到,我将尽快回复,谢谢。刘欢

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

LeoWood commented 2 months ago

您的邮件已收到,我将尽快回复,谢谢。刘欢

luckytalk commented 2 months ago

带参考视频的模型已经调起来了,但是最终生成的模型还是只是头部能动,身体部分还是不动?