|  | 
 
| 在Colab 上用MimicTalk训练数字人 
 脚本地址:
 https://colab.research.google.co ... rollTo=OjU021Om659c
 
 地址2
 https://colab.research.google.co ... 46S2g3V?usp=sharing
 
 
 能顺利安装mmcv和pytorch3d
 
 Building wheels for collected packages: mmcv
 Building wheel for mmcv (setup.py) ... done
 Created wheel for mmcv: filename=mmcv-2.1.0-cp39-cp39-linux_x86_64.whl size=1322078 sha256=55fe258d3108ce4a73093be7e6accbd37780e35774b6912a61fd85cd0687fe06
 Stored in directory: /root/.cache/pip/wheels/eb/be/7a/1cbc064b54f14e1f1e5b9133bc0b7e416904b784e86b478e10
 Successfully built mmcv
 Installing collected packages: addict, tomli, termcolor, pyparsing, platformdirs, opencv-python, kiwisolver, importlib-resources, fonttools, cycler, contourpy, yapf, matplotlib, mmengine, mmcv
 Successfully installed addict-2.4.0 contourpy-1.3.0 cycler-0.12.1 fonttools-4.55.3 importlib-resources-6.4.5 kiwisolver-1.4.7 matplotlib-3.9.3 mmcv-2.1.0 mmengine-0.10.5 opencv-python-4.10.0.84 platformdirs-4.3.6 pyparsing-3.2.0 termcolor-2.5.0 tomli-2.2.1 yapf-0.43.0
 Collecting git+https://github.com/facebookresearch/pytorch3d.git@stable
 Cloning https://github.com/facebookresearch/pytorch3d.git (to revision stable) to /tmp/pip-req-build-r7ge5w39
 Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/pytorch3d.git /tmp/pip-req-build-r7ge5w39
 Running command git checkout -q 75ebeeaea0908c5527e7b1e305fbc7681382db47
 Resolved https://github.com/facebookresearch/pytorch3d.git to commit 75ebeeaea0908c5527e7b1e305fbc7681382db47
 Preparing metadata (setup.py) ... done
 Collecting iopath (from pytorch3d==0.7.8)
 Downloading iopath-0.1.10.tar.gz (42 kB)
 Preparing metadata (setup.py) ... done
 Requirement already satisfied: tqdm in /content/local/miniconda/envs/mimictalk/lib/python3.9/site-packages (from iopath->pytorch3d==0.7.8) (4.65.2)
 Requirement already satisfied: typing_extensions in /content/local/miniconda/envs/mimictalk/lib/python3.9/site-packages (from iopath->pytorch3d==0.7.8) (4.9.0)
 Collecting portalocker (from iopath->pytorch3d==0.7.8)
 Downloading portalocker-3.0.0-py3-none-any.whl.metadata (8.5 kB)
 Downloading portalocker-3.0.0-py3-none-any.whl (19 kB)
 Building wheels for collected packages: pytorch3d, iopath
 Building wheel for pytorch3d (setup.py) ... done
 Created wheel for pytorch3d: filename=pytorch3d-0.7.8-cp39-cp39-linux_x86_64.whl size=980119 sha256=55d70f0222733cde2c0e3e69ab5fb9530a994eaf4739e5746c353b3e6e2d249e
 Stored in directory: /tmp/pip-ephem-wheel-cache-thub4ums/wheels/d7/e2/25/51fb3f170ac9f43bf7d1bd4bdbf67e4a34104adc2ecfe5f62e
 Building wheel for iopath (setup.py) ... done
 Created wheel for iopath: filename=iopath-0.1.10-py3-none-any.whl size=31545 sha256=8e1071c6aac511e5e1d4c5483b8bf98653e35aa883e11767f47454c811576d83
 Stored in directory: /root/.cache/pip/wheels/c1/13/6d/441d8f2af76ee6d2a3e67eebb1d0c556fefcee0a8b32266a8e
 Successfully built pytorch3d iopath
 Installing collected packages: portalocker, iopath, pytorch3d
 Successfully installed iopath-0.1.10 portalocker-3.0.0 pytorch3d-0.7.8
 
 运行视频训练和推理前还是要修改源代码的
 
 下面是修改方法:
 
 Traceback (most recent call last):
 File "/content/local/miniconda/envs/mimictalk/MimicTalk/inference/mimictalk_infer.py", line 18, in <module>
 from utils.commons.hparams import hparams, set_hparams
 ModuleNotFoundError: No module named 'utils'
 
 在 inference/mimictalk_infer.py 和 inference/train_mimictalk_on_a_video.py文件中添加:
 import sys
 sys.path.append('./')  #将当前目录 (./) 添加到 Python 模块搜索路径中,使得可以导入当前目录下的模块。
 
 ===========================================
 
 安装组件时遇到的问题:
 
 Building wheels for collected packages: pyaudio
 Running command Building wheel for pyaudio (pyproject.toml)
 running bdist_wheel
 running build
 running build_py
 creating build/lib.linux-x86_64-cpython-39/pyaudio
 copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-39/pyaudio
 running build_ext
 building 'pyaudio._portaudio' extension
 creating build/temp.linux-x86_64-cpython-39/src/pyaudio
 gcc -pthread -B /content/local/miniconda/envs/mimictalk/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /content/local/miniconda/envs/mimictalk/include -I/content/local/miniconda/envs/mimictalk/include -fPIC -O2 -isystem /content/local/miniconda/envs/mimictalk/include -fPIC -I/usr/local/include -I/usr/include -I/content/local/miniconda/envs/mimictalk/include/python3.9 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-39/src/pyaudio/device_api.o
 src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
 9 | #include "portaudio.h"
 |          ^~~~~~~~~~~~~
 compilation terminated.
 error: command '/usr/bin/gcc' failed with exit code 1
 error: subprocess-exited-with-error
 
 × Building wheel for pyaudio (pyproject.toml) did not run successfully.
 │ exit code: 1
 ╰─> See above for output.
 
 note: This error originates from a subprocess, and is likely not a problem with pip.
 full command: /content/local/miniconda/envs/mimictalk/bin/python /content/local/miniconda/envs/mimictalk/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpy328lh56
 cwd: /tmp/pip-install-1703o6g1/pyaudio_66d22200ef194f3986428a21635963fd
 Building wheel for pyaudio (pyproject.toml) ... error
 ERROR: Failed building wheel for pyaudio
 Failed to build pyaudio
 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)
 
 问题出在安装 pyaudio 时无法找到 portaudio.h 文件,这个文件是 PyAudio 库所依赖的 PortAudio 库的头文件。以下是问题的原因和解决方法:
 安装 portaudio 系统依赖
 在安装 PyAudio 之前,您需要确保 PortAudio 库已安装。运行以下命令安装:
 
 # 在 Colab 或 Linux 系统中安装 PortAudio
 !apt-get install -y portaudio19-dev
 
 
 
 
 ===========================
 WARNING: The following packages were previously imported in this runtime:
 [_distutils_hack,setuptools]
 You must restart the runtime in order to use newly installed versions.
 
 此警告表明,在当前的 Colab 运行时中已经加载了一些与新安装的包相关的模块(例如 setuptools 和 _distutils_hack),但这些模块是旧版本的。新安装的版本无法覆盖已经加载的旧模块,因此需要重启运行时以便使用新安装的包
 | 
 |