先看部署成功后,简单训练的结果
cogvideo 训练3
1.下载项目到本地
git clone https://github.com/THUDM/CogVideo.git
cd CogVideo
建立虚拟环境
python -m venv cogvenv
source cogvenv/bin/activate
2.安装依赖
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
这里使用清华源加速下载
中间错误1:
ERROR: Ignored the following yanked versions: 3.4.11.39, 3.4.17.61, 4.4.0.42, 4.4.0.44, 4.5.4.58, 4.5.5.62, 4.7.0.68
ERROR: Ignored the following versions that require a different python version: 0.55.2 Requires-Python <3.5
ERROR: Could not find a version that satisfies the requirement opencv-python==4.10 (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.63, 3.4.18.65, 4.3.0.38, 4.4.0.40, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.60, 4.5.5.64, 4.6.0.66, 4.7.0.72, 4.8.0.74, 4.8.0.76, 4.8.1.78, 4.9.0.80, 4.10.0.82, 4.10.0.84)
ERROR: No matching distribution found for opencv-python==4.10
修改依赖的版本
vim requirements.txt
opencv-python==4.10 # For diffusers inference origin export video
修改为opencv-python==4.10.0.82
错误2
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pillow
Failed to build pillow
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pillow)
vim requirements.txt
机器是python3.12的
所以 pillow==9.5.0 修改为 pillow==10.1
参考下面的截图不同版本支持
官网地址:Python Support - Pillow (PIL Fork) 11.0.0.dev0 documentation
最终文件内容requirements.txt
就可以一路安装成功了
安装成功后,根据官方介绍操作
1.cd inference/
python gradio_web_demo.py
Traceback (most recent call last):
File "/home/ai/test/cogVideo-main/inference/gradio_web_demo.py", line 13, in <module>
import moviepy.editor as mp
ModuleNotFoundError: No module named 'moviepy'
缺少moviepy,直接按照
pip install moviepy
再次执行,如果可能会访问不到国外的网络,如果网络正常,则正常下载了
10几个G的资源,大约20分钟,下载完成,根据最后的Runing 地址就可以打开了。
这里有个提示说没有output文件夹,Ctrl+C停止脚本
mkdir output 给建立一个
然后再python gradio_web_demo.py
等待程序启动,就可以访问了,成功界面大约是这样