ONNX 模型库
返回模型

说明文档

AnimateDiff 提示词旅行

AnimateDiff 结合提示词旅行 + ControlNet + IP-Adapter

我在 animatediff-cli 中添加了一个实验性功能,可以在帧中间切换提示词。

效果出奇地好!

示例

<div><video controls src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/e2ce68b0-f904-4fc3-8d5c-2224b5ffc1d3" muted="false"></video></div> <br>

<div><video controls src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/2f1965f2-9a50-485e-ac95-e888a3189ba2" muted="false"></video></div> <br>

  • 从左到右编号。
  • 1.提示词 + lora
  • 2.提示词 + lora + IP-Adapter(缩放 0.5)
  • 3.提示词 + lora + IP-Adapter Plus(缩放 0.5)
  • 4.提示词 + lora + Controlnet Reference Only(style_fidelity 0)
  • 输入图像

0000

<div><video controls src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/d9d300a9-1107-4a3b-a1f1-3245b49dde10" muted="false"></video></div> <br>

  • controlnet_openpose + controlnet_softedge

  • controlnet 的输入帧(第 0、16、32 帧) <img src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/4adac698-75a4-4c6d-bf64-a5723d0e3e77" width="512">

  • 结果 <div><video controls src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/50aa9d0d-15b6-4c84-a497-8d020d3bdb7c" muted="false"></video></div> <br>

  • 在最新版本中,现在可以通过提示词更精确地控制生成。

  • 示例 1

    "prompt_fixed_ratio": 0.8,
    "head_prompt": "1girl, wizard, circlet, earrings, jewelry, purple hair,",
    "prompt_map": {
        "0": "(standing,full_body),blue_sky, town",
        "8": "(sitting,full_body),rain, town",
        "16": "(standing,full_body),blue_sky, woods",
        "24": "(upper_body), beach",
        "32": "(upper_body, smile)",
        "40": "(upper_body, angry)",
        "48": "(upper_body, smile, from_above)",
        "56": "(upper_body, angry, from_side)",
        "64": "(upper_body, smile, from_below)",
        "72": "(upper_body, angry, from_behind, looking at viewer)",
        "80": "face,looking at viewer",
        "88": "face,looking at viewer, closed_eyes",
        "96": "face,looking at viewer, open eyes, open_mouth",
        "104": "face,looking at viewer, closed_eyes, closed_mouth",
        "112": "face,looking at viewer, open eyes,eyes, open_mouth, tongue, smile, laughing",
        "120": "face,looking at viewer, eating, bowl,chopsticks,holding,food"
    },

<div><video controls src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/c4de4b87-f302-4d61-98c7-9607dece386f" muted="false"></video></div> <br>

  • 示例 2
    "prompt_fixed_ratio": 1.0,
    "head_prompt": "1girl, wizard, circlet, earrings, jewelry, purple hair,",
    "prompt_map": {
        "0": "",
        "8": "((fire magic spell, fire background))",
        "16": "((ice magic spell, ice background))",
        "24": "((thunder magic spell, thunder background))",
        "32": "((skull magic spell, skull background))",
        "40": "((wind magic spell, wind background))",
        "48": "((stone magic spell, stone background))",
        "56": "((holy magic spell, holy background))",
        "64": "((star magic spell, star background))",
        "72": "((plant magic spell, plant background))",
        "80": "((meteor magic spell, meteor background))"
    },

<div><video controls src="https://github.com/s9roll7/animatediff-cli-prompt-travel/assets/118420657/31a5827d-e551-4937-8b67-51747a92d14c" muted="false"></video></div> <br>

安装(Windows)

与原版 animatediff-cli 相同
必须安装 Python 3.10 和 git 客户端
(几天前 PyTorch 2.1 发布了,但在情况稳定之前,安装旧版本更安全。
#87)

git clone https://github.com/s9roll7/animatediff-cli-prompt-travel.git
cd animatediff-cli-prompt-travel
py -3.10 -m venv venv
venv\Scripts\activate.bat
set PYTHONUTF8=1
python -m pip install --upgrade pip
# Torch 安装必须根据环境进行调整。
python -m pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
python -m pip install -e .
python -m pip install xformers

# 如果你想使用 'stylize' 命令,还需要安装
python -m pip install -e .[stylize]

# 如果你想使用 dwpose 作为 controlnet_openpose 的预处理器,还需要安装
python -m pip install -e .[dwpose]
# (DWPose 是 Openpose 的更强大版本)

# 如果你想使用 'stylize create-mask' 和 'stylize composite' 命令,还需要安装
python -m pip install -e .[stylize_mask]

(https://www.reddit.com/r/StableDiffusion/comments/157c0wl/working_animatediff_cli_windows_install/)

我找到了详细的教程
(https://www.reddit.com/r/StableDiffusion/comments/16vlk9j/guide_to_creating_videos_with/)
(https://www.youtube.com/watch?v=7_hh3wOD81s)

使用方法

与原版 animatediff-cli 几乎相同,但配置格式略有变化。

# prompt_travel.json
{
  "name": "sample",
  "path": "share/Stable-diffusion/mistoonAnime_v20.safetensors",  # 指定 Checkpoint 为相对于 /animatediff-cli/data 的路径
  "vae_path":"share/VAE/vae-ft-mse-840000-ema-pruned.ckpt",       # 指定 vae 为相对于 /animatediff-cli/data 的路径
  "motion_module": "models/motion-module/mm_sd_v14.ckpt",         # 指定 motion module 为相对于 /animatediff-cli/data 的路径
  "compile": false,
  "seed": [
    341774366206100,-1,-1         # -1 表示随机。如果指定了 "--repeats 3",在此设置下,第一次将是 341774366206100,第二次和第三次将是随机的。
  ],
  "scheduler": "ddim",      # "ddim","euler","euler_a","k_dpmpp_2m" 等...
  "steps": 40,
  "guidance_scale": 20,     # cfg scale
  "clip_skip": 2,
  "head_prompt": "masterpiece, best quality, a beautiful and detailed portriat of muffet, monster girl,((purple body:1.3)),humanoid, arachnid, anthro,((fangs)),pigtails,hair bows,5 eyes,spider girl,6 arms,solo",
  "prompt_map": {           # "帧号" : "提示词" 格式 / 例如:第 32 帧的提示词是 "head_prompt" + prompt_map["32"] + "tail_prompt"
    "0":  "smile standing,((spider webs:1.0))",
    "32":  "(((walking))),((spider webs:1.0))",
    "64":  "(((running))),((spider webs:2.0)),wide angle lens, fish eye effect",
    "96":  "(((sitting))),((spider webs:1.0))"
  },
  "tail_prompt": "clothed, open mouth, awesome and detailed background, holding teapot, holding teacup, 6 hands,detailed hands,storefront that sells pastries and tea,bloomers,(red and black clothing),inside,pouring into teacup,muffetwear",
  "n_prompt": [
    "(worst quality, low quality:1.4),nudity,simple background,border,mouth closed,text, patreon,bed,bedroom,white background,((monochrome)),sketch,(pink body:1.4),7 arms,8 arms,4 arms"
  ],
  "lora_map": {             # "LORA路径" : 强度 格式
    "share/Lora/muffet_v2.safetensors" : 1.0,                     # 指定 lora 为相对于 /animatediff-cli/data 的路径
    "share/Lora/add_detail.safetensors" : 1.0                     # Lora 支持有限。并非所有格式都能使用!!!
  },
  "motion_lora_map": {      # "LORA路径" : 强度 格式
    "models/motion_lora/v2_lora_RollingAnticlockwise.ckpt":0.5,   # 目前,官方分发的 lora 似乎只适用于 v2 motion modules (mm_sd_v15_v2.ckpt)。
    "models/motion_lora/v2_lora_ZoomIn.ckpt":0.5
  },
  "ip_adapter_map": {       # ip-adapter 配置
      # 启用/禁用(重要)
      "enable": true,
      # 指定相对于 /animatediff-cli/data 的输入图像目录(重要!无需在配置文件中指定帧。对生成的影响与提示词的放置逻辑完全相同)
      "input_image_dir": "ip_adapter_image/test",
      # 是否保存输入图像
      "save_input_image": true,
      # 图像提示词与文本提示词的比例(重要)。即使你想在 1.0 时仅强调图像提示词,也不要将 prompt/neg prompt 留空,而是指定如 "best quality" 等通用文本。
      "scale": 0.5,
      # IP-Adapter 或 IP-Adapter Plus 或 IP-Adapter Plus Face(重要)结果会完全不同。PLUS 不总是更好的结果。
      "is_plus_face": true,
      "is_plus": true
  },
  "controlnet_map": {       # controlnet 配置(用于生成)
    "input_image_dir" : "controlnet_image/test",    # 指定相对于 /animatediff-cli/data 的输入图像目录(重要!请参考示例的目录结构。无需在配置文件中指定帧。)
    "max_samples_on_vram" : 200,    # 如果为 controlnet 指定大量图像且 vram 不足,请减小此值。0 表示将所有内容放在 cpu 中。
    "max_models_on_vram" : 3,       # 放置在 vram 中的 controlnet 模型数量
    "save_detectmap" : true,        # 是否保存预处理图像
    "preprocess_on_gpu": true,      # 是否在 gpu 上运行预处理(可能不影响峰值 vram 使用,所以应该始终设为 true。)
    "is_loop": true,                # controlnet 效果是否考虑循环

    "controlnet_tile":{    # controlnet_tile 配置
      "enable": true,              # 启用/禁用(重要)
      "use_preprocessor":true,      # 是否为每个 controlnet 类型使用预处理器
      "preprocessor":{     # 如果未指定,则选择默认预处理器。(大多数情况下默认应该没问题。)
        # none/blur/tile_resample/upernet_seg/ 或 controlnet_aux.processor.MODELS 中的键
        # https://github.com/patrickvonplaten/controlnet_aux/blob/2fd027162e7aef8c18d0a9b5a344727d37f4f13d/src/controlnet_aux/processor.py#L20
        "type" : "tile_resample",
        "param":{
          "down_sampling_rate":2.0
        }
      },
      "guess_mode":false,
      "controlnet_conditioning_scale": 1.0,    # 控制权重(重要)
      "control_guidance_start": 0.0,       # 开始控制步数
      "control_guidance_end": 1.0,         # 结束控制步数
      "control_scale_list":[0.5,0.4,0.3,0.2,0.1]    # 对相邻帧的影响列表(重要)
    },                                              # 这意味着对两个相邻帧有 0.5 的影响,对下一个有 0.4 的影响。尝试加长、缩短或更改内部的值。
    "controlnet_ip2p":{
      "enable": true,
      "use_preprocessor":true,
      "guess_mode":false,
      "controlnet_conditioning_scale": 1.0,
      "control_guidance_start": 0.0,
      "control_guidance_end": 1.0,
      "control_scale_list":[0.5,0.4,0.3,0.2,0.1]
    },
    "controlnet_lineart_anime":{
      "enable": true,
      "use_preprocessor":true,
      "guess_mode":false,
      "controlnet_conditioning_scale": 1.0,
      "control_guidance_start": 0.0,
      "control_guidance_end": 1.0,
      "control_scale_list":[0.5,0.4,0.3,0.2,0.1]
    },
    "controlnet_openpose":{
      "enable": true,
      "use_preprocessor":true,
      "guess_mode":false,
      "controlnet_conditioning_scale": 1.0,
      "control_guidance_start": 0.0,
      "control_guidance_end": 1.0,
      "control_scale_list":[0.5,0.4,0.3,0.2,0.1]
    },
    "controlnet_softedge":{
      "enable": true,
      "use_preprocessor":true,
      "preprocessor":{
        "type" : "softedge_pidsafe",
        "param":{
        }
      },
      "guess_mode":false,
      "controlnet_conditioning_scale": 1.0,
      "control_guidance_start": 0.0,
      "control_guidance_end": 1.0,
      "control_scale_list":[0.5,0.4,0.3,0.2,0.1]
    },
    "controlnet_ref": {
        "enable": false,            # 启用/禁用(重要)
        "ref_image": "ref_image/ref_sample.png",     # 参考图像路径。
        "attention_auto_machine_weight": 1.0,
        "gn_auto_machine_weight": 1.0,
        "style_fidelity": 0.5,                # 类似控制权重的参数(重要)
        "reference_attn": true,               # [attn=true , adain=false] 表示 "reference_only"
        "reference_adain": false,
        "scale_pattern":[0.5]                 # 将 controlnet_ref 应用于帧的模式
    }                                         # 例如 [0.5] 表示 [0.5,0.5,0.5,0.5,0.5 .... ]。所有帧都受 50% 的影响
                                              # 例如 [1, 0] 表示 [1,0,1,0,1,0,1,0,1,0,1 ....]。仅偶数帧受 100% 的影响。
  },
  "upscale_config": {       # tile-upscale 配置
    "scheduler": "ddim",
    "steps": 20,
    "strength": 0.5,
    "guidance_scale": 10,
    "controlnet_tile": {    # controlnet tile 配置
      "enable": true,       # 启用/禁用(重要)
      "controlnet_conditioning_scale": 1.0,     # 控制权重(重要)
      "guess_mode": false,
      "control_guidance_start": 0.0,      # 开始控制步数
      "control_guidance_end": 1.0         # 结束控制步数
    },
    "controlnet_line_anime": {  # controlnet line anime 配置
      "enable": false,
      "controlnet_conditioning_scale": 1.0,
      "guess_mode": false,
      "control_guidance_start": 0.0,
      "control_guidance_end": 1.0
    },
    "controlnet_ip2p": {  # controlnet ip2p 配置
      "enable": false,
      "controlnet_conditioning_scale": 0.5,
      "guess_mode": false,
      "control_guidance_start": 0.0,
      "control_guidance_end": 1.0
    },
    "controlnet_ref": {   # controlnet ref 配置
      "enable": false,             # 启用/禁用(重要)
      "use_frame_as_ref_image": false,   # 将原始帧作为每次放大的 ref_image(重要)
      "use_1st_frame_as_ref_image": false,   # 将第一个原始帧作为所有放大的 ref_image(重要)
      "ref_image": "ref_image/path_to_your_ref_img.jpg",   # 使用指定的图像文件作为所有放大的 ref_image(重要)
      "attention_auto_machine_weight": 1.0,
      "gn_auto_machine_weight": 1.0,
      "style_fidelity": 0.25,       # 类似控制权重的参数(重要)
      "reference_attn": true,       # [attn=true , adain=false] 表示 "reference_only"
      "reference_adain": false
    }
  },
  "output":{   # 输出格式 
    "format" : "gif",   # gif/mp4/webm
    "fps" : 8,
    "encode_param":{
      "crf": 10
    }
  }
}
cd animatediff-cli-prompt-travel
venv\Scripts\activate.bat

# 在此设置下,我的环境(RTX4090)生成大约需要一分钟。VRAM 使用量为 6-7 GB
# 宽度 256 / 高度 384 / 长度 128 帧 / 上下文 16 帧
animatediff generate -c config/prompts/prompt_travel.json -W 256 -H 384 -L 128 -C 16
# 5分钟 / 9-10GB
animatediff generate -c config/prompts/prompt_travel.json -W 512 -H 768 -L 128 -C 16

# 使用 controlnet 进行放大
# 指定上一步生成的帧目录
# 默认配置路径为 'frames_dir/../prompt.json'
# 这里指定了 width=512,但即使原始尺寸是 512,也能有效增加细节
animatediff tile-upscale 目标帧目录路径 -c config/prompts/prompt_travel.json -W 512

# 将宽度放大到 768(比 tile-upscale 更平滑)
animatediff refine 目标帧目录路径 -W 768
# 如果生成时间异常长,说明 vram 不足。
# 放弃大尺寸或减小上下文大小。
animatediff refine 目标帧目录路径 -W 1024 -C 6

# 更改 lora 和提示词以对视频进行小幅修改。
animatediff refine 目标帧目录路径 -c config/prompts/some_minor_changed.json

视频风格化

cd animatediff-cli-prompt-travel
venv\Scripts\activate.bat

# 如果你想使用 'stylize' 命令,需要额外安装
python -m pip install -e .[stylize]

# 从源视频创建配置文件
animatediff stylize create-config 你的源视频文件.mp4

# 参考命令完成时日志中显示的提示来编辑配置文件
# 建议在测试运行时指定较短的长度

# 生成(测试运行)
# 16 帧
animatediff stylize generate STYLYZE_DIR -L 16
# 从第 200 帧开始的 16 帧
animatediff stylize generate STYLYZE_DIR -L 16 -FO 200

# 如果生成时间异常长,说明 vram 不足。
# 放弃大尺寸或减小上下文大小。

# 生成
animatediff stylize generate STYLYZE_DIR

带遮罩的视频风格化

cd animatediff-cli-prompt-travel
venv\Scripts\activate.bat

# 如果你想使用 'stylize create-mask' 命令,需要额外安装
python -m pip install -e .[stylize_mask]

# [1] 从源视频创建配置文件
animatediff stylize create-config 你的源视频文件.mp4
# 在 prompt.json(在 [1] 中生成)中
# [2] 写入你想要遮罩的对象
# 例如:如果你想遮罩一个人
    "stylize_config": {
        "create_mask": [
            "person"
        ],
        "composite": {
# 例如:person, dog, cat
    "stylize_config": {
        "create_mask": [
            "person", "dog", "cat"
        ],
        "composite": {
# 例如:boy, girl
    "stylize_config": {
        "create_mask": [
            "boy", "girl"
        ],
        "composite": {
# [3] 生成遮罩
animatediff stylize create-mask STYLYZE_DIR

# 如果你的 vram 小于 12GB,请指定低 vram 模式
animatediff stylize create-mask STYLYZE_DIR -lo

# 前景输出到以下目录 (FG_STYLYZE_DIR)
# STYLYZE_DIR/fg_00_timestamp_str
# 背景输出到以下目录 (BG_STYLYZE_DIR)
# STYLYZE_DIR/bg_timestamp_str

# [4] 生成前景
animatediff stylize generate FG_STYLYZE_DIR

# 与普通生成相同。
# 默认是 controlnet_tile,所以如果你想做大的风格改变,
# 比如更改角色,请切换到 openpose 等。

# 当然,你也可以在这里生成背景。
# 在 prompt.json(在 [1] 中生成)中
# [5] 合成设置
# 在 "fg_list" 中输入包含 [4] 中生成的帧的目录。
# 在 "mask_prompt" 字段中,写入你想要从生成的前景帧中提取的对象。
# 如果你自己准备了遮罩,请在 mask_path 中指定。如果设置了有效路径,则使用它。
# 如果生成前景时形状没有改变,可以使用 FG_STYLYZE_DIR/00_mask
# 在 "bg_frame_dir" 中输入 [3] 中分离的背景帧目录。
        "composite": {
            "fg_list": [
                {
                    "path": "FG_STYLYZE_DIR/time_stamp_str/00-341774366206100",
                    "mask_path": " 遮罩目录的绝对路径(这是可选的) ",
                    "mask_prompt": "person"
                },
                {
                    "path": " 帧目录的绝对路径 ",
                    "mask_path": " 遮罩目录的绝对路径(这是可选的) ",
                    "mask_prompt": "cat"
                }
            ],
            "bg_frame_dir": "BG_STYLYZE_DIR/00_controlnet_image/controlnet_tile",
            "hint": ""
        },
# [6] 合成
animatediff stylize composite STYLYZE_DIR

# 有关详细选项,请参阅帮助。

为 Stable-Diffusion-Webui-Civitai-Helper 用户自动生成配置

# 此命令解析 *.civitai.info 文件并自动生成配置文件
# 有关详细信息,请参阅 "animatediff civitai2config -h"
animatediff civitai2config 你的_A111_LORA_目录路径

通配符

  • 你可以从 civitai 获取通配符,然后将它们放在 /wildcards 中。
  • 用法与 a1111 相同。(WILDCARDFILENAME 格式, 例如 animal 对应 animal.txt。background-color 对应 background-color.txt。)
  "prompt_map": {           # __WILDCARDFILENAME__
    "0":  "__character-posture__, __character-gesture__, __character-emotion__, masterpiece, best quality, a beautiful and detailed portriat of muffet, monster girl,((purple body:1.3)), __background__",

推荐设置

  • checkpoint : 动漫使用 mistoonAnime_v20,照片写实使用 xxmix9realistic_v40
  • scheduler : "k_dpmpp_sde"
  • upscale : 仅启用 controlnet_tile 和 controlnet_ip2p。如果你能提供好的参考图像,controlnet_ref 也可能有用。

8-12 GB vram 的推荐设置

  • max_samples_on_vram : 使用 controlnet 时如果 vram 不足,设为 0
  • max_models_on_vram : 1
  • 以较低分辨率生成,然后放大到更高分辨率
animatediff generate -c config/prompts/your_config.json -W 384 -H 576 -L 48 -C 16
animatediff tile-upscale output/2023-08-25T20-00-00-sample-mistoonanime_v20/00-341774366206100 -W 512

限制

  • lora 支持有限。并非所有格式都能使用!!!
  • 无法在提示词中指定 lora。

相关资源

<br> <br> <br> <br> <br>

以下是原始 readme。


animatediff

pre-commit.ci status

animatediff 重构,因为我可以。 显存使用量显著降低。

而且,支持无限生成长度! 太棒了!

LoRA 加载功能绝对尚未实现!

理论上可以在 CPU 上运行,但不推荐。在 GPU 上应该可以正常工作,无论是 nVidia 还是其他品牌, 但我还没有在非 CUDA 硬件上测试过。默认使用 PyTorch 2.0 Scaled-Dot-Product Attention(即内置 xformers), 但如果你真的想用,可以传递 --xformers 来强制使用 xformers。

如何使用

  1. 躺下
  2. 试着不要哭
  3. 大哭一场

说真的?

好吧,行。但还是有点复杂,而且还没有 webUI。

git clone https://github.com/neggles/animatediff-cli
cd animatediff-cli
python3.10 -m venv .venv
source .venv/bin/activate
# 安装 Torch。使用你喜欢的 torch 版本 >= 2.0.0,但是,在非 nVidia 上祝你好运...
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# 安装所有其他东西(可能!我可能漏掉了一些依赖。)
python -m pip install -e '.[dev]'
# 你现在应该可以
animatediff --help
# 这里会打印一个漂亮的信息屏幕,包含一堆信息。

从这里开始,你需要将你想使用的任何 checkpoint 放入 data/models/sd,复制 config/prompts 中的一个提示词配置,用你选择的提示词和模型进行编辑(提示词 .json 文件中的模型 路径是相对于 data/ 的,例如 models/sd/vanilla.safetensors),然后 你就可以开始了。

然后就像这样(对于 8GB 显卡):

animatediff generate -c 'config/prompts/waifu.json' -W 576 -H 576 -L 128 -C 16

在显存小于 8GB 的显卡上,你可能需要将 -C 降到 8,在显存更多的显卡上可以提高到 20-24。 最大是 24。

注意:生成 128 帧_很慢..._

RiFE!

我添加了对 rife-ncnn-vulkan 的实验性支持,使用 animatediff rife interpolate 命令。它有相当直观的帮助信息,并且已经 在 Linux 上测试过,但我不知道它是否能在 Windows 上工作。

无论哪种方式,你都需要在系统上安装 ffmpeg 并存在于 PATH 中,并且你需要 从 GitHub 仓库(上面)下载适合你操作系统的 rife-ncnn-vulkan 版本。解压它,并 将解压后的文件夹放在 data/rife/。你应该有一个 data/rife/rife-ncnn-vulkan 可执行文件,或者在 Windows 上是 data\rife\rife-ncnn-vulkan.exe。

你还需要使用以下命令重新安装仓库/包:

python -m pip install -e '.[rife]'

或者只是自己手动安装 ffmpeg-python。

默认是将每帧乘以 8,将 8fps 动画变成 64fps,然后编码 成 60fps 的 WebM。(如果你选择 GIF 模式,它将是 50fps,因为 GIF 是被诅咒的,并且将 帧持续时间编码为 1/100 秒)。

看起来效果不错...

待办事项:

排名不分先后:

  • [x] 无限生成长度支持
  • [x] RIFE 支持用于运动插值(rife-ncnn-vulkan 不是最好的实现)
  • [x] 将 RIFE 插值帧导出为视频文件(webm、mp4、动画 webp、hevc mp4、gif 等)
  • [x] 在 6-8GB 显卡上生成无限长度动画(512x512,8 帧上下文,但也还行)
  • [x] Torch SDP Attention(使 xformers 可选)
  • [x] 支持提示词配置中的 clip_skip
  • [x] 实验性支持 torch.compile()(上游 Diffusers 的 bug 会稍微减慢速度,但仍然很快)
  • [x] 使用 --repeat 批量生成!(例如 --repeat 10 将重复所有提示词 10 次)
  • [x] 从另一个 Python 程序调用 animatediff.cli.generate() 函数,而无需每次重新加载模型
  • [x] 将剩余的旧 Diffusers 代码更新到最新版本(大部分)
  • [ ] 添加 webUI(也许,已经有人在封装这个了,所以可能不会?)
  • [ ] img2img 支持(从现有图像开始并继续)
  • [ ] 尽可能停止使用自定义模块(应该几乎全部可以使用 Diffusers)
  • [ ] 自动生成然后使用 RIFE 插值模式

致谢:

参见 guoyww/AnimateDiff(这几乎不是我的工作)

注意:COPYING 中的版权声明缺少原作者的姓名,仅仅是因为 原始仓库(截至本文撰写时)的许可证没有附上姓名。但是,我 使用了与他们相同的许可证(Apache 2.0)。

zguo0525/animatediff

作者 zguo0525

diffusers
↓ 0 ♥ 6

创建时间: 2023-10-11 15:00:12+00:00

更新时间: 2023-10-11 15:16:58+00:00

在 Hugging Face 上查看

文件 (231)

.editorconfig
.gitattributes
.gitignore
.pre-commit-config.yaml
.vscode/settings.json
COPYING
LICENSE.md
MANIFEST.in
README.md
config/.gitignore
config/GroundingDINO/GroundingDINO_SwinB_cfg.py
config/GroundingDINO/GroundingDINO_SwinT_OGC.py
config/inference/default.json
config/inference/motion_v2.json
config/inference/sd15-unet.json
config/inference/sd15-unet3d.json
config/prompts/.gitignore
config/prompts/01-ToonYou.json
config/prompts/02-Lyriel.json
config/prompts/03-RcnzCartoon.json
config/prompts/04-MajicMix.json
config/prompts/05-RealisticVision.json
config/prompts/06-Tusun.json
config/prompts/07-FilmVelvia.json
config/prompts/08-GhibliBackground.json
config/prompts/concat_2horizontal.bat
config/prompts/ignore_tokens.txt
config/prompts/prompt_travel.json
config/prompts/prompt_travel_multi_controlnet.json
config/prompts/to_8fps_Frames.bat
data/.gitignore
data/controlnet_image/test/controlnet_canny/put_pngs_here.txt
data/controlnet_image/test/controlnet_depth/put_pngs_here.txt
data/controlnet_image/test/controlnet_inpaint/put_pngs_here.txt
data/controlnet_image/test/controlnet_ip2p/put_pngs_here.txt
data/controlnet_image/test/controlnet_lineart/put_pngs_here.txt
data/controlnet_image/test/controlnet_lineart_anime/put_pngs_here.txt
data/controlnet_image/test/controlnet_mlsd/put_pngs_here.txt
data/controlnet_image/test/controlnet_normalbae/put_pngs_here.txt
data/controlnet_image/test/controlnet_openpose/0000.png
data/controlnet_image/test/controlnet_openpose/0016.png
data/controlnet_image/test/controlnet_openpose/0032.png
data/controlnet_image/test/controlnet_openpose/put_pngs_here.txt
data/controlnet_image/test/controlnet_scribble/put_pngs_here.txt
data/controlnet_image/test/controlnet_seg/put_pngs_here.txt
data/controlnet_image/test/controlnet_shuffle/put_pngs_here.txt
data/controlnet_image/test/controlnet_softedge/0000.png
data/controlnet_image/test/controlnet_softedge/0016.png
data/controlnet_image/test/controlnet_softedge/0032.png
data/controlnet_image/test/controlnet_softedge/put_pngs_here.txt
data/controlnet_image/test/controlnet_tile/put_pngs_here.txt
data/embeddings/.gitignore
data/ip_adapter_image/test/put_pngs_here.txt
data/models/.gitignore
data/models/DWPose/dw-ll_ucoco_384.onnx ONNX
data/models/DWPose/yolox_l.onnx ONNX
data/models/huggingface/.gitignore
data/models/huggingface/stable-diffusion-v1-5/feature_extractor/preprocessor_config.json
data/models/huggingface/stable-diffusion-v1-5/model_index.json
data/models/huggingface/stable-diffusion-v1-5/safety_checker/config.json
data/models/huggingface/stable-diffusion-v1-5/safety_checker/model.safetensors
data/models/huggingface/stable-diffusion-v1-5/scheduler/scheduler_config.json
data/models/huggingface/stable-diffusion-v1-5/text_encoder/config.json
data/models/huggingface/stable-diffusion-v1-5/text_encoder/model.safetensors
data/models/huggingface/stable-diffusion-v1-5/tokenizer/added_tokens.json
data/models/huggingface/stable-diffusion-v1-5/tokenizer/merges.txt
data/models/huggingface/stable-diffusion-v1-5/tokenizer/special_tokens_map.json
data/models/huggingface/stable-diffusion-v1-5/tokenizer/tokenizer_config.json
data/models/huggingface/stable-diffusion-v1-5/tokenizer/vocab.json
data/models/huggingface/stable-diffusion-v1-5/unet/config.json
data/models/huggingface/stable-diffusion-v1-5/unet/diffusion_pytorch_model.safetensors
data/models/huggingface/stable-diffusion-v1-5/vae/config.json
data/models/huggingface/stable-diffusion-v1-5/vae/diffusion_pytorch_model.safetensors
data/models/motion-module/.gitignore
data/models/motion-module/animatediff/.gitattributes
data/models/motion-module/animatediff/README.md
data/models/motion-module/animatediff/mm_sd_v14.ckpt
data/models/motion-module/animatediff/mm_sd_v15.ckpt
data/models/motion-module/animatediff/mm_sd_v15_v2.ckpt
data/models/motion-module/animatediff/v2_lora_PanLeft.ckpt
data/models/motion-module/animatediff/v2_lora_PanRight.ckpt
data/models/motion-module/animatediff/v2_lora_RollingAnticlockwise.ckpt
data/models/motion-module/animatediff/v2_lora_RollingClockwise.ckpt
data/models/motion-module/animatediff/v2_lora_TiltDown.ckpt
data/models/motion-module/animatediff/v2_lora_TiltUp.ckpt
data/models/motion-module/animatediff/v2_lora_ZoomIn.ckpt
data/models/motion-module/animatediff/v2_lora_ZoomOut.ckpt
data/models/sd/.gitignore
data/ref_image/put_pngs_here.txt
data/ref_image/ref_sample.png
data/rife/.gitignore
data/share/lora/add_detail.safetensors
data/share/lora/more_detail.safetensors
data/share/sd_models/AllBoyMix.safetensors
data/share/sd_models/Anything.safetensors
data/share/sd_models/Cetus-Mix.safetensors
data/share/sd_models/ChilloutMix.safetensors
data/share/sd_models/MoonFilm.safetensors
data/share/sd_models/XXMix_9realistic.safetensors
data/share/sd_models/beautifulRealistic_v7.safetensors
data/share/sd_models/majicmixRealistic.safetensors
data/share/sd_models/mistoonAnime_v20.safetensors
generate_loop.py
pyproject.toml
refine/.gitignore
run_bash.sh
scripts/download/01-Motion-Modules.sh
scripts/download/02-All-SD-Models.sh
scripts/download/03-BaseSD.py
scripts/download/11-ToonYou.sh
scripts/download/12-Lyriel.sh
scripts/download/13-RcnzCartoon.sh
scripts/download/14-MajicMix.sh
scripts/download/15-RealisticVision.sh
scripts/download/16-Tusun.sh
scripts/download/17-FilmVelvia.sh
scripts/download/18-GhibliBackground.sh
scripts/download/sd-models.aria2
scripts/test_persistent.py
setup.cfg
setup.py
src/animatediff.egg-info/PKG-INFO
src/animatediff.egg-info/SOURCES.txt
src/animatediff.egg-info/dependency_links.txt
src/animatediff.egg-info/entry_points.txt
src/animatediff.egg-info/requires.txt
src/animatediff.egg-info/top_level.txt
src/animatediff/__init__.py
src/animatediff/__main__.py
src/animatediff/__pycache__/__init__.cpython-310.pyc
src/animatediff/__pycache__/_version.cpython-310.pyc
src/animatediff/__pycache__/cli.cpython-310.pyc
src/animatediff/__pycache__/generate.cpython-310.pyc
src/animatediff/__pycache__/schedulers.cpython-310.pyc
src/animatediff/__pycache__/settings.cpython-310.pyc
src/animatediff/__pycache__/stylize.cpython-310.pyc
src/animatediff/_version.py
src/animatediff/cli.py
src/animatediff/dwpose/__init__.py
src/animatediff/dwpose/__pycache__/__init__.cpython-310.pyc
src/animatediff/dwpose/__pycache__/onnxdet.cpython-310.pyc
src/animatediff/dwpose/__pycache__/onnxpose.cpython-310.pyc
src/animatediff/dwpose/__pycache__/util.cpython-310.pyc
src/animatediff/dwpose/__pycache__/wholebody.cpython-310.pyc
src/animatediff/dwpose/onnxdet.py
src/animatediff/dwpose/onnxpose.py
src/animatediff/dwpose/util.py
src/animatediff/dwpose/wholebody.py
src/animatediff/generate.py
src/animatediff/ip_adapter/__init__.py
src/animatediff/ip_adapter/__pycache__/__init__.cpython-310.pyc
src/animatediff/ip_adapter/__pycache__/attention_processor.cpython-310.pyc
src/animatediff/ip_adapter/__pycache__/ip_adapter.cpython-310.pyc
src/animatediff/ip_adapter/__pycache__/resampler.cpython-310.pyc
src/animatediff/ip_adapter/__pycache__/utils.cpython-310.pyc
src/animatediff/ip_adapter/attention_processor.py
src/animatediff/ip_adapter/ip_adapter.py
src/animatediff/ip_adapter/resampler.py
src/animatediff/ip_adapter/utils.py
src/animatediff/models/__init__.py
src/animatediff/models/__pycache__/__init__.cpython-310.pyc
src/animatediff/models/__pycache__/attention.cpython-310.pyc
src/animatediff/models/__pycache__/clip.cpython-310.pyc
src/animatediff/models/__pycache__/motion_module.cpython-310.pyc
src/animatediff/models/__pycache__/resnet.cpython-310.pyc
src/animatediff/models/__pycache__/unet.cpython-310.pyc
src/animatediff/models/__pycache__/unet_blocks.cpython-310.pyc
src/animatediff/models/attention.py
src/animatediff/models/clip.py
src/animatediff/models/motion_module.py
src/animatediff/models/resnet.py
src/animatediff/models/unet.py
src/animatediff/models/unet_blocks.py
src/animatediff/pipelines/__init__.py
src/animatediff/pipelines/__pycache__/__init__.cpython-310.pyc
src/animatediff/pipelines/__pycache__/animation.cpython-310.pyc
src/animatediff/pipelines/__pycache__/context.cpython-310.pyc
src/animatediff/pipelines/__pycache__/pipeline_controlnet_img2img_reference.cpython-310.pyc
src/animatediff/pipelines/__pycache__/ti.cpython-310.pyc
src/animatediff/pipelines/animation.py
src/animatediff/pipelines/context.py
src/animatediff/pipelines/pipeline_controlnet_img2img_reference.py
src/animatediff/pipelines/ti.py
src/animatediff/repo/.gitignore
src/animatediff/rife/__init__.py
src/animatediff/rife/__pycache__/__init__.cpython-310.pyc
src/animatediff/rife/__pycache__/ffmpeg.cpython-310.pyc
src/animatediff/rife/__pycache__/ncnn.cpython-310.pyc
src/animatediff/rife/__pycache__/rife.cpython-310.pyc
src/animatediff/rife/ffmpeg.py
src/animatediff/rife/ncnn.py
src/animatediff/rife/rife.py
src/animatediff/schedulers.py
src/animatediff/settings.py
src/animatediff/softmax_splatting/README.md
src/animatediff/softmax_splatting/correlation/README.md
src/animatediff/softmax_splatting/correlation/correlation.py
src/animatediff/softmax_splatting/run.py
src/animatediff/softmax_splatting/softsplat.py
src/animatediff/stylize.py
src/animatediff/utils/__init__.py
src/animatediff/utils/__pycache__/__init__.cpython-310.pyc
src/animatediff/utils/__pycache__/civitai2config.cpython-310.pyc
src/animatediff/utils/__pycache__/convert_from_ckpt.cpython-310.pyc
src/animatediff/utils/__pycache__/convert_lora_safetensor_to_diffusers.cpython-310.pyc
src/animatediff/utils/__pycache__/device.cpython-310.pyc
src/animatediff/utils/__pycache__/huggingface.cpython-310.pyc
src/animatediff/utils/__pycache__/lora_diffusers.cpython-310.pyc
src/animatediff/utils/__pycache__/lpw_stable_diffusion.cpython-310.pyc
src/animatediff/utils/__pycache__/model.cpython-310.pyc
src/animatediff/utils/__pycache__/pipeline.cpython-310.pyc
src/animatediff/utils/__pycache__/tagger.cpython-310.pyc
src/animatediff/utils/__pycache__/util.cpython-310.pyc
src/animatediff/utils/__pycache__/wild_card.cpython-310.pyc
src/animatediff/utils/civitai2config.py
src/animatediff/utils/composite.py
src/animatediff/utils/convert_from_ckpt.py
src/animatediff/utils/convert_lora_safetensor_to_diffusers.py
src/animatediff/utils/device.py
src/animatediff/utils/huggingface.py
src/animatediff/utils/lora_diffusers.py
src/animatediff/utils/lpw_stable_diffusion.py
src/animatediff/utils/mask.py
src/animatediff/utils/model.py
src/animatediff/utils/pipeline.py
src/animatediff/utils/tagger.py
src/animatediff/utils/util.py
src/animatediff/utils/wild_card.py
stylize/.gitignore
upscaled/.gitignore
wildcards/.gitignore