1 问题描述
(dreamtalk) [root@localhost dreamtalk]# python inference_for_demo_video.py --wav_path data/audio/acknowledgement_english.m4a --style_clip_path data/style_clip/3DMM/M030_front_neutral_level1_001.mat --pose_path data/pose/RichardShelby_front_neutral_level1_001.mat --image_path data/src_img/uncropped/male_face.png --cfg_scale 1.0 --max_gen_len 30 --output_name acknowledgement_english@M030_front_neutral_level1_001@male_face
ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developersbuilt with gcc 7.3.0 (crosstool-NG 1.23.0.449-a04d0)configuration: --prefix=/opt/conda/conda-bld/ffmpeg_1597178665428/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh --cc=/opt/conda/conda-bld/ffmpeg_1597178665428/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-pic --enable-pthreads --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libmp3lamelibavutil 56. 51.100 / 56. 51.100libavcodec 58. 91.100 / 58. 91.100libavformat 58. 45.100 / 58. 45.100libavdevice 58. 10.100 / 58. 10.100libavfilter 7. 85.100 / 7. 85.100libavresample 4. 0. 0 / 4. 0. 0libswscale 5. 7.100 / 5. 7.100libswresample 3. 7.100 / 3. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'data/audio/acknowledgement_english.m4a':Metadata:major_brand : M4A minor_version : 0compatible_brands: M4A isommp42creation_time : 2023-12-20T14:25:20.000000ZiTunSMPB : 00000000 00000840 00000000 00000000000C23C0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000Duration: 00:00:16.57, start: 0.044000, bitrate: 246 kb/sStream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 244 kb/s (default)Metadata:creation_time : 2023-12-20T14:25:20.000000Zhandler_name : Core Media Audio
Stream mapping:Stream #0:0 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
Output #0, wav, to 'tmp/acknowledgement_english@M030_front_neutral_level1_001@male_face/acknowledgement_english@M030_front_neutral_level1_001@male_face_16K.wav':Metadata:major_brand : M4A minor_version : 0compatible_brands: M4A isommp42iTunSMPB : 00000000 00000840 00000000 00000000000C23C0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000ISFT : Lavf58.45.100Stream #0:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s (default)Metadata:creation_time : 2023-12-20T14:25:20.000000Zhandler_name : Core Media Audioencoder : Lavc58.91.100 pcm_s16le
size= 518kB time=00:00:16.57 bitrate= 256.0kbits/s speed= 587x
video:0kB audio:518kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.014706%
/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/models/wav2vec2/processing_wav2vec2.py:53: FutureWarning: Loading a tokenizer inside Wav2Vec2Processor from a config that does not include a `tokenizer_class` attribute is deprecated and will be removed in v5. Please add `'tokenizer_class': 'Wav2Vec2CTCTokenizer'` attribute to either your `config.json` or `tokenizer_config.json` file to suppress this warning: warnings.warn(
Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_connconn = connection.create_connection(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connectionraise errFile "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connectionsock.connect(sa)
OSError: [Errno 101] Network is unreachableDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopenhttplib_response = self._make_request(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_requestself._validate_conn(conn)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_connconn.connect()File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connectconn = self._new_conn()File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connection.py", line 181, in _new_connraise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f5e0bd08910>: Failed to establish a new connection: [Errno 101] Network is unreachableDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/adapters.py", line 486, in sendresp = conn.urlopen(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopenretries = retries.increment(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in incrementraise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /jonatasgrosman/wav2vec2-large-xlsr-53-english/resolve/main/preprocessor_config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5e0bd08910>: Failed to establish a new connection: [Errno 101] Network is unreachable'))During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1238, in hf_hub_downloadmetadata = get_hf_file_metadata(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fnreturn fn(*args, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1631, in get_hf_file_metadatar = _request_wrapper(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 385, in _request_wrapperresponse = _request_wrapper(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 408, in _request_wrapperresponse = get_session().request(method=method, url=url, **params)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/sessions.py", line 589, in requestresp = self.send(prep, **send_kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/sessions.py", line 703, in sendr = adapter.send(request, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/utils/_http.py", line 67, in sendreturn super().send(request, *args, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/adapters.py", line 519, in sendraise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /jonatasgrosman/wav2vec2-large-xlsr-53-english/resolve/main/preprocessor_config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5e0bd08910>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 925ffb1d-4d68-4ec4-b1c2-988e43c1d1f7)')The above exception was the direct cause of the following exception:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/utils/hub.py", line 409, in cached_fileresolved_file = hf_hub_download(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fnreturn fn(*args, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1371, in hf_hub_downloadraise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/models/wav2vec2/processing_wav2vec2.py", line 51, in from_pretrainedreturn super().from_pretrained(pretrained_model_name_or_path, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/processing_utils.py", line 184, in from_pretrainedargs = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/processing_utils.py", line 228, in _get_arguments_from_pretrainedargs.append(attribute_class.from_pretrained(pretrained_model_name_or_path, **kwargs))File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/feature_extraction_utils.py", line 329, in from_pretrainedfeature_extractor_dict, kwargs = cls.get_feature_extractor_dict(pretrained_model_name_or_path, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/feature_extraction_utils.py", line 429, in get_feature_extractor_dictresolved_feature_extractor_file = cached_file(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/utils/hub.py", line 443, in cached_fileraise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like jonatasgrosman/wav2vec2-large-xlsr-53-english is not the path to a directory containing a file named preprocessor_config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_connconn = connection.create_connection(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/util/connection.py", line 96, in create_connectionraise errFile "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/util/connection.py", line 86, in create_connectionsock.connect(sa)
OSError: [Errno 101] Network is unreachableDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopenhttplib_response = self._make_request(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_requestself._validate_conn(conn)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_connconn.connect()File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connectconn = self._new_conn()File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connection.py", line 181, in _new_connraise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f5f3fca9070>: Failed to establish a new connection: [Errno 101] Network is unreachableDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/adapters.py", line 486, in sendresp = conn.urlopen(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopenretries = retries.increment(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in incrementraise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /jonatasgrosman/wav2vec2-large-xlsr-53-english/resolve/main/preprocessor_config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5f3fca9070>: Failed to establish a new connection: [Errno 101] Network is unreachable'))During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1238, in hf_hub_downloadmetadata = get_hf_file_metadata(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fnreturn fn(*args, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1631, in get_hf_file_metadatar = _request_wrapper(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 385, in _request_wrapperresponse = _request_wrapper(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 408, in _request_wrapperresponse = get_session().request(method=method, url=url, **params)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/sessions.py", line 589, in requestresp = self.send(prep, **send_kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/sessions.py", line 703, in sendr = adapter.send(request, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/utils/_http.py", line 67, in sendreturn super().send(request, *args, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/requests/adapters.py", line 519, in sendraise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /jonatasgrosman/wav2vec2-large-xlsr-53-english/resolve/main/preprocessor_config.json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f5f3fca9070>: Failed to establish a new connection: [Errno 101] Network is unreachable'))"), '(Request ID: 44658a52-de92-48c0-8add-47c36288bb81)')The above exception was the direct cause of the following exception:Traceback (most recent call last):File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/utils/hub.py", line 409, in cached_fileresolved_file = hf_hub_download(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fnreturn fn(*args, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1371, in hf_hub_downloadraise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/opt/dreamtalk/inference_for_demo_video.py", line 180, in <module>wav2vec_processor = Wav2Vec2Processor.from_pretrained(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/models/wav2vec2/processing_wav2vec2.py", line 62, in from_pretrainedfeature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(pretrained_model_name_or_path, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/feature_extraction_utils.py", line 329, in from_pretrainedfeature_extractor_dict, kwargs = cls.get_feature_extractor_dict(pretrained_model_name_or_path, **kwargs)File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/feature_extraction_utils.py", line 429, in get_feature_extractor_dictresolved_feature_extractor_file = cached_file(File "/root/anaconda3/envs/dreamtalk/lib/python3.9/site-packages/transformers/utils/hub.py", line 443, in cached_fileraise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like jonatasgrosman/wav2vec2-large-xlsr-53-english is not the path to a directory containing a file named preprocessor_config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
2 问题分析
从异常中分析可知,模型运行时,通过网络加载huggingface的模型,网络连接异常所致。
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like jonatasgrosman/wav2vec2-large-xlsr-53-english is not the path to a directory containing a file named preprocessor_config.json.
3 问题解决
手动下载文件,下载地址:
https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english/tree/main
下载如下文件,保存到根目录的jonatasgrosmanwav2vec2-large-xlsr-53-english目录下:
(dreamtalk) [root@localhost dreamtalk]# ll jonatasgrosmanwav2vec2-large-xlsr-53-english/
总用量 1232504
-rw-r--r-- 1 root root 1531 1月 22 18:32 config.json
-rw-r--r-- 1 root root 262 1月 22 18:32 preprocessor_config.json
-rw-r--r-- 1 root root 1262069143 1月 22 18:34 pytorch_model.bin
-rw-r--r-- 1 root root 300 1月 22 18:34 vocab.json
4 conda环境介绍
Conda是一个开源的包管理器和环境管理系统,用于安装、运行和更新包和其依赖项。它是由Anaconda, Inc.(以前称为Continuum Analytics)创建,用于支持Python程序开发,但它也可以用来管理来自其他语言的包。Conda使得包管理和环境隔离变得简单,对于处理多个项目中的依赖关系和版本控制尤其有用。
Conda是一个强大的工具,对于管理复杂的Python项目和环境至关重要。它简化了包管理和环境设置,使得Python开发更加容易和高效。通过使用Conda,开发者可以确保他们的项目在不同机器和操作系统上都能以相同的方式运行,大大提高了项目的可移植性和可复现性。
4.1 Conda的核心概念
-
包管理:Conda作为包管理器,能够安装、更新和卸载软件包。这些包可能包含Python或其他编程语言的库和应用程序。Conda通过包含所有依赖性的方式来解决包之间的依赖关系问题。
-
环境管理:Conda允许用户创建隔离的环境,以便在不同的项目之间切换,而不会导致依赖项或版本的冲突。每个环境都有自己的一套独立的安装的软件包。
-
跨平台:Conda是跨平台的,可以在Windows、macOS和Linux操作系统上运行。这使得在不同操作系统上保持一致的开发和部署环境成为可能。
-
语言无关性:虽然Conda最初是为Python生态系统设计的,但它实际上是语言无关的,可以管理多种编程语言的软件包。
-
通道(Channels):Conda软件包可以从所谓的“通道”中获得。这些通道是包存储库,可以是公共的或私有的。Anaconda Cloud提供了许多预建的包,而用户也可以创建自己的通道来托管和分享包。
-
依赖和兼容性管理:Conda在安装软件包时会自动处理依赖关系和版本控制,确保所有依赖项都兼容,并且不会发生冲突。
4.2 使用Conda的优势
-
解决依赖性问题:Conda可以自动解决包之间的依赖关系,简化了安装过程。
-
环境隔离:创建独立的环境可以避免包之间的版本冲突,使得项目更稳定。
-
易于使用:Conda的命令行界面简单直观,易于学习和使用。
-
广泛的包支持:Conda支持Python的许多流行库和应用程序。
-
社区支持:作为一个流行的工具,Conda拥有一个活跃的社区,用户可以从中找到支持和资源。
4.3 Conda环境的创建和管理
-
创建新环境:使用
conda create
命令创建一个新环境,可以指定Python版本和所需的包。 -
激活环境:使用
conda activate
命令来激活环境。 -
安装包:在激活的环境中使用
conda install
命令来安装新的包。 -
环境列表:使用
conda env list
来查看所有可用的Conda环境。 -
移除环境:使用
conda env remove
命令来移除不再需要的环境。
4.4 应用场景
Conda作为一个强大的包和环境管理工具,广泛应用于需要精确控制依赖和环境的各种软件开发和科学计算领域,主要包括:
-
数据科学和机器学习项目:由于Conda可以轻松安装和管理各种数据科学和机器学习的库(如NumPy, Pandas, Scikit-learn, TensorFlow, PyTorch等),它成为了这些领域专家的首选工具。
-
多语言项目:对于涉及Python、R、Ruby、Lua、Scala等多种编程语言的项目,Conda能够有效管理不同语言的依赖和环境,使项目维护变得更加简单。
-
环境隔离:在需要为不同项目创建隔离的运行环境时,Conda可以创建独立的环境,每个环境具有不同的库和版本,这有助于防止依赖冲突。
-
跨平台开发:由于Conda支持Windows、macOS和Linux,它允许开发者在不同的操作系统上以一致的方式设置和维护他们的开发环境。
-
科学研究:在科学研究中,需要使用特定版本的软件和库来重现实验结果。Conda可以确保这些环境的一致性和可复制性。
-
软件开发:对于需要确保应用程序在特定版本的库上正常运行的开发场景,Conda可以帮助管理和锁定这些依赖。
-
教育和培训:在教育场景中,Conda可以帮助创建统一的学习环境,确保所有学生都在相同的软件设置下学习。
-
持续集成/持续部署(CI/CD):在自动化构建和部署流程中,Conda可以用于创建和管理构建环境,确保软件在不同环境中的一致性和可靠性。
4.5 常用命令
Conda 是一个开源的包管理器和环境管理器,广泛用于管理Python环境和包。以下是一些常用的 Conda 命令:
-
安装 Conda 包:
conda install [package-name]
: 安装指定的包。
-
创建和管理环境:
conda create --name [env-name]
: 创建一个新的环境。conda activate [env-name]
: 激活指定环境。conda deactivate
: 退出当前环境。conda env list
: 列出所有可用的环境。
-
管理包:
conda list
: 在当前环境中列出所有已安装的包。conda update [package-name]
: 更新指定的包。conda remove [package-name]
: 移除指定的包。
-
搜索包:
conda search [package-name]
: 搜索可用的包版本。
-
环境导出和导入:
conda env export > environment.yml
: 导出当前环境的配置到一个YAML文件。conda env create -f environment.yml
: 使用YAML文件创建一个新环境。
-
更新 Conda:
conda update conda
: 更新 Conda 到最新版本。
-
查看 Conda 信息:
conda info
: 显示关于 Conda 的信息。