科学工具
科学工具让世界更美好
让世界更美好

MagicAnimate 将一张静态图片变成动画的工具

MagicAnimate是一款利用扩散模型实现时序一致人体图像动画的工具,由新加坡国立大学和字节跳动的研究人员共同开发,它能够根据输入的内容生成具有时序一致性的人体动画。

模型下载

1、下载StableDiffusion V1.5的预训练基础模型和MSE微调的VAE模型。

2、下载MagicAnimate的检查点。

可按照Hugging Face的下载说明来获取上述模型和检查点,推荐使用git lfs

模型放置

将基础模型和检查点按以下结构放置:

magic-animate
|----pretrained_models
  |----MagicAnimate
    |----appearance_encoder
      |----diffusion_pytorch_model.safetensors
      |----config.json
    |----densepose_controlnet
      |----diffusion_pytorch_model.safetensors
      |----config.json
    |----temporal_attention
      |----temporal_attention.ckpt
  |----sd-vae-ft-mse
    |----config.json
    |----diffusion_pytorch_model.safetensors
  |----stable-diffusion-v1-5
    |----scheduler
       |----scheduler_config.json
    |----text_encoder
       |----config.json
       |----pytorch_model.bin
    |----tokenizer (all)
    |----unet
       |----diffusion_pytorch_model.bin
       |----config.json
    |----v1-5-pruned-emaonly.safetensors
|----...

安装步骤

需要python>=3.8CUDA>=11.3以及ffmpeg

安装方式

• 使用conda安装:

conda env create -f environment.yaml
conda activate manimate

• 使用pip安装:

pip3 install -r requirements.txt

推理操作

• 单GPU上运行推理:

bash scripts/animate.sh

• 多GPU上运行推理:

bash scripts/animate_dist.sh

Gradio演示

在线演示

可以快速尝试在线的Gradio演示,在线演示地址:huggingface.co/spaces/zcxu-eric/magicanimate

本地演示

• 单GPU上启动本地Gradio演示:

python3 -m demo.gradio_animate

• 多GPU情况下启动本地Gradio演示:

python3 -m demo.gradio_animate_dist

之后在本地浏览器中打开Gradio演示即可。