linux conda 配置 stable video diffusion

在这里插入图片描述

安装教程

1 下载仓库源码

git clone https://github.com/Stability-AI/generative-models.git

2 创建conda环境

conda create -n svd python=3.10
conda activate svd

3 安装pytorch gpu

cuda和cudnn请参考其他链接配置,使用 conda 或者 pip 安装 pytorch

# 使用conda 安装 pytorch ,推荐该方式,防止gpu版本安装不上,出现import torch错误
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia
# 使用 pip 安装 pytorch
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118

4 安装其他依赖包

cd generative-models
# pip联网安装依赖库
pip install -r requirements/pt2.txt
# 编译安装本地sgm
pip install .
# 安装sdata用于训练,贫民显卡3090也训练不起,无需安装
pip3 install -e git+https://github.com/Stability-AI/datapipelines.git@main#egg=sdata

--------------------------------------------安装结束-----------------------------------------

图片转视频教程

SVD: This model was trained to generate 14 frames at resolution 576x1024 given a context frame of the same size.

SVD-XT: Same architecture as SVD but finetuned for 25 frame generation.

下载权重文件:svd.safetensorssvd_image_decoder.safetensors 放到 checkpoints/ 文件夹下

方案一:streamlit 网页可视化

streamlit run scripts/demo/video_sampling.py

方案二:python 脚本执行

python scripts/sampling/simple_video_sample.py

可能遇到的问题

1 pip安装时import torch报错

使用conda 安装,会自动配置cuda版本

2 显存不足报错

decoding_t 调小

decoding_t: int = 2,  # Number of frames decoded at a time! This eats most VRAM. Reduce if necessary.

3 opencv报错

错误信息:OpenCV: FFMPEG: tag 0x5634504d/‘MP4V’ is not supported with codec id 12 and format ‘mp4 / MP4 (MPEG-4 Part 14)’
解决:将 cv2.VideoWriter_fourcc(*"MP4V") 改为 cv2.VideoWriter_fourcc('m', 'p', '4', 'v')

  • 7
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值