animatediff-motion-adapter-v1-4

我要开发同款
匿名用户2024年07月31日
30阅读

技术信息

官网地址
https://www.shlab.org.cn/
开源地址
https://modelscope.cn/models/Shanghai_AI_Laboratory/animatediff-motion-adapter-v1-4

作品详情

AimateDiff is a method that allows you to create videos usig pre-existig Stable Diffusio Text to Image models.

It achieves this by isertig motio module layers ito a froze text to image model ad traiig it o video clips to extract a motio prior. These motio modules are applied after the ResNet ad Attetio blocks i the Stable Diffusio UNet. Their purpose is to itroduce coheret motio across image frames. To support these modules we itroduce the cocepts of a MotioAdapter ad UNetMotioModel. These serve as a coveiet way to use these motio modules with existig Stable Diffusio models.

masterpiece, bestquality, suset.
masterpiece, bestquality, suset

The followig example demostrates how you ca utilize the motio modules with a existig Stable Diffusio text to image model.

Istall requiremets:

pip istall trasformers peft diffusers -U
import torch
from diffusers import MotioAdapter, AimateDiffPipelie, DDIMScheduler
from diffusers.utils import export_to_gif
from modelscope import sapshot_dowload


model_dir = sapshot_dowload("Shaghai_AI_Laboratory/aimatediff-motio-adapter-v1-4")
# Load the motio adapter
adapter = MotioAdapter.from_pretraied(model_dir)
# load SD 1.5 based fietued model
model_id = sapshot_dowload("wyj123456/Realistic_Visio_V5.1_oVAE")
pipe = AimateDiffPipelie.from_pretraied(model_id, motio_adapter=adapter)
scheduler = DDIMScheduler.from_pretraied(
    model_id, subfolder="scheduler", clip_sample=False, timestep_spacig="lispace", steps_offset=1
)
pipe.scheduler = scheduler

# eable memory savigs
pipe.eable_vae_slicig()
pipe.eable_model_cpu_offload()

output = pipe(
    prompt=(
        "masterpiece, bestquality, highlydetailed, ultradetailed, suset, "
        "orage sky, warm lightig, fishig boats, ocea waves seagulls, "
        "ripplig water, wharf, silhouette, seree atmosphere, dusk, eveig glow, "
        "golde hour, coastal ladscape, seaside sceery"
    ),
    egative_prompt="bad quality, worse quality",
    um_frames=16,
    guidace_scale=7.5,
    um_iferece_steps=25,
    geerator=torch.Geerator("cpu").maual_seed(42),
)
frames = output.frames[0]
export_to_gif(frames, "aimatio.gif")

AimateDiff teds to work better with fietued Stable Diffusio models. If you pla o usig a scheduler that ca clip samples, make sure to disable it by settig clip_sample=False i the scheduler as this ca also have a adverse effect o geerated samples.

功能介绍

AnimateDiff is a method that allows you to create videos using pre-existing Stable Diffusion Text to

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论