当前位置:   article > 正文

linux conda 配置 stable video diffusion_stable video diffusion 配置

stable video diffusion 配置

在这里插入图片描述

安装教程

1 下载仓库源码

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

2 创建conda环境

conda create -n svd python=3.10
conda activate svd
  • 1
  • 2

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
  • 1
  • 2
# 使用 pip 安装 pytorch
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
  • 1
  • 2

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

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

图片转视频教程

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
  • 1

方案二:python 脚本执行

python scripts/sampling/simple_video_sample.py
  • 1

可能遇到的问题

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.
  • 1

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')

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号