🚀 Tune-A-Video - Redshift
Tune-A-Video - Redshift 是一个基于特定基础模型训练的项目,可用于文本到视频的生成,通过特定的训练提示,能生成如人物滑雪等风格的视频。
🚀 快速开始
克隆仓库
首先,你需要克隆 github 仓库。
git clone https://github.com/showlab/Tune-A-Video.git
运行推理代码
from tuneavideo.pipelines.pipeline_tuneavideo import TuneAVideoPipeline
from tuneavideo.models.unet import UNet3DConditionModel
from tuneavideo.util import save_videos_grid
import torch
pretrained_model_path = "nitrosocke/redshift-diffusion"
unet_model_path = "Tune-A-Video-library/redshift-man-skiing"
unet = UNet3DConditionModel.from_pretrained(unet_model_path, subfolder='unet', torch_dtype=torch.float16).to('cuda')
pipe = TuneAVideoPipeline.from_pretrained(pretrained_model_path, unet=unet, torch_dtype=torch.float16).to("cuda")
pipe.enable_xformers_memory_efficient_attention()
prompt = "(redshift style) spider man is skiing"
video = pipe(prompt, video_length=8, height=512, width=512, num_inference_steps=50, guidance_scale=7.5).videos
save_videos_grid(video, f"./{prompt}.gif")
✨ 主要特性
📦 安装指南
克隆项目所需的仓库:
git clone https://github.com/showlab/Tune-A-Video.git
💻 使用示例
基础用法
from tuneavideo.pipelines.pipeline_tuneavideo import TuneAVideoPipeline
from tuneavideo.models.unet import UNet3DConditionModel
from tuneavideo.util import save_videos_grid
import torch
pretrained_model_path = "nitrosocke/redshift-diffusion"
unet_model_path = "Tune-A-Video-library/redshift-man-skiing"
unet = UNet3DConditionModel.from_pretrained(unet_model_path, subfolder='unet', torch_dtype=torch.float16).to('cuda')
pipe = TuneAVideoPipeline.from_pretrained(pretrained_model_path, unet=unet, torch_dtype=torch.float16).to("cuda")
pipe.enable_xformers_memory_efficient_attention()
prompt = "(redshift style) spider man is skiing"
video = pipe(prompt, video_length=8, height=512, width=512, num_inference_steps=50, guidance_scale=7.5).videos
save_videos_grid(video, f"./{prompt}.gif")
📚 详细文档
模型描述
示例展示
此为训练示例。
测试提示:(redshift style) [spider man/black widow/batman/hulk] is skiing。
相关论文
- Tune-A-Video:One-Shot Tuning of Image Diffusion Models for Text-to-Video Generation
- Stable Diffusion:High-Resolution Image Synthesis with Latent Diffusion Models
📄 许可证
本项目使用 creativeml-openrail-m 许可证。