在這里插入代碼片
# 虛擬環境配置
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']}"