🚀 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 許可證。