在这里插入代码片
# 虚拟环境配置
pip install pip -U
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 xformers==0.0.28.post3 --index-url https://download.pytorch.org/whl/cu124
pip install torchao --index-url https://download.pytorch.org/whl/nightly/cu124
pip install -r requirements.txt
pip install --no-deps facenet_pytorch==2.6.0
export FFMPEG_PATH=/path/to/ffmpeg-4.4-amd64-static
预训练权重下载
export HF_ENDPOINT=https://hf-mirror.com
pip install -U huggingface_hub
huggingface-cli download BadToBest/EchoMimicV2 --local-dir ./pretrained_weights
备注
export HF_HOME="/path/to/your/hf_home_directory"
export TRANSFORMERS_CACHE="/path/to/your/transformers_cache_directory"
export HF_DATASETS_CACHE="/path/to/your/datasets_cache_directory"
运行 web_demo.py
# 切换到项目工作目录
cd echomimic_v2# 激活 echomimic 虚拟环境
conda fs# 设置 Gradio 服务器名称和端口
export GRADIO_SERVER_NAME=0.0.0.0
export GRADIO_SERVER_PORT=8080# 运行 app.py 文件
python app.py
报错如下
TypeError: argument of type 'bool' is not iterable
Traceback (most recent call last):File "/root/autodl-tmp/echomimic_v2/app.py", line 277, in <module>demo.launch(inbrowser=True)File "/root/miniconda3/envs/fs/lib/python3.10/site-packages/gradio/blocks.py", line 2582, in launchraise ValueError(
ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.
1、预训练权重下载不全,正确的的权重文件应该是
但是我的是
这是因为使用 git clone 命令克隆仓库时,默认情况下只会下载 Git 仓库中的普通文件,而不会自动下载通过 Git LFS 管理的大文件(如模型权重文件)。这就是为什么你没有看到 sd-vae-ft-mse、sd-image-variations-diffusers 和 audio_processor/tiny.pt 等文件的原因
2、下载frpc_linux_amd64并重命名为frpc_linux_amd64_
0.3,移动到/root/miniconda3/envs/fs/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.3.
再给它添加可执行权限:chmod +x frpc_linux_amd64_v0.3
下载链接:https://cdn-media.hf-mirror.com/frpc-gradio-0.3/frpc_linux_amd64
修改后提示:
(fs) root@autodl-container-00274fbfbe-ea8b014a:~/autodl-tmp/echomimic_v2# python app.py
CUDA版本:12.4
Pytorch版本:2.5.1+cu124
显卡型号:NVIDIA GeForce RTX 4090 D
显存大小:23.55GB
精度:float16
please download ffmpeg-static and export to FFMPEG_PATH.
For example: export FFMPEG_PATH=./ffmpeg-4.4-amd64-static
* Running on local URL: http://127.0.0.1:7862Could not create share link. Missing file: /root/.cache/huggingface/gradio/frpc/frpc_linux_amd64_v0.3. Please check your internet connection. This can happen if your antivirus software blocks the download of this file. You can install manually by following these steps: 1. Download this file: https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64
2. Rename the downloaded file to: frpc_linux_amd64_v0.3
3. Move the file to this location: /root/.cache/huggingface/gradio/frpc
修改文件路径
# 创建目标目录(如果尚未存在)
mkdir -p /root/.cache/huggingface/gradio/frpc# 复制文件
cp /root/miniconda3/envs/fs/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.3 /root/.cache/huggingface/gradio/frpc/
然后又提示
python app.py
CUDA版本:12.4
Pytorch版本:2.5.1+cu124
显卡型号:NVIDIA GeForce RTX 4090 D
显存大小:23.55GB
精度:float16
please download ffmpeg-static and export to FFMPEG_PATH.
For example: export FFMPEG_PATH=./ffmpeg-4.4-amd64-static
* Running on local URL: http://127.0.0.1:7862
* Running on public URL: https://64346135c101f829e7.gradio.liveThis share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)
问题1:ffmpeg-static 未正确设置
问题2:Gradio 共享链接问题
# 下载并解压 ffmpeg
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
tar -xvf ffmpeg-release-amd64-static.tar.xz#设置环境变量
export FFMPEG_PATH=/你的路径/ffmpeg-4.4-amd64-static#验证
$FFMPEG_PATH/ffmpeg -version#在app.py中添加
import os
ffmpeg_path = "/你的路径/ffmpeg-4.4-amd64-static"
os.environ["PATH"] = f"{ffmpeg_path}:{os.environ['PATH']}"