Open-Sora1.2环境搭建&推理测试

引子

前阵子写了一篇Open-Sora1.0环境搭建&推理测试(Open-Sora1.0环境搭建&推理测试_自己搭建sora服务-CSDN博客,感兴趣的童鞋,请移步)。Open-Sora1.1发布的时候,撇了一眼新闻。后面一转头,忘记这个事情了。无意间翻到其开源网站上,发现2024.6.17发布1.2版本了,那还是过来看看有什么长足的进步吧,呦呵,现在支持720P 高清视频,质量和生成时长也有了突破性进展。OK,那就让我们开始吧。

一、升级介绍

在上一个版本基础上,引入了视频压缩网络(Video Compression Network)、更优的扩散模型算法、更多的可控性,并利用更多的数据训练出了 1.1B 的扩散生成模型。Stable Diffusion 3,最新的扩散模型,通过采用了 rectified flow 技术替代 DDPM,显著提升了图片和视频生成的质量。尽管 SD3 的 rectified flow 训练代码尚未公开,但潞晨 Open-Sora 团队已经基于 SD3 的研究成果,提供了一套完整的训练解决方案,包括:

(1)简单易用的整流(rectified flow)训练

(2)用于训练加速的 Logit-norm 时间步长采样

(3)基于分辨率和视频长度的时间步长采样

二、环境安装

(1)模型下载

https://huggingface.co/hpcai-tech/OpenSora-STDiT-v3/tree/main

https://huggingface.co/hpcai-tech/OpenSora-VAE-v1.2/tree/main

https://huggingface.co/PixArt-alpha/pixart_sigma_sdxlvae_T5_diffusers/tree/main/vae

(2)代码下载

git clone GitHub - hpcaitech/Open-Sora: Open-Sora: Democratizing Efficient Video Production for All

三、推理测试

docker run -it --gpus=all --rm -v /datas/work/zzq/:/workspace open-sora:v1.0 bash

pip install -v .

git clone GitHub - PixArt-alpha/PixArt-sigma: PixArt-Σ: Weak-to-Strong Training of Diffusion Transformer for 4K Text-to-Image Generation

cd PixArt-sigma

pip install -r requirements.txt

注:open-sora:v1.0为上一篇OpenSora博文安装的docker镜像名称

修改代码

修改代码 vi /opt/conda/lib/python3.10/site-packages/opensora/models/vae/vae.py

python scripts/inference.py configs/opensora-v1-2/inference/sample.py --num-frames 4s --resolution 720p --aspect-ratio 9:16 --num-sampling-steps 30 --flow 5 --aes 6.5 --prompt "a beautiful waterfall"

显存不够,改小分辨率

python scripts/inference.py configs/opensora-v1-2/inference/sample.py --num-frames 4s --resolution 144p --aspect-ratio 9:16 --num-sampling-steps 30 --flow 5 --aes 6.5 --prompt "a beautiful waterfall"

 

posted @ 2024-07-08 15:05  要养家的程序猿  阅读(61)  评论(0编辑  收藏  举报