This commit is contained in:
thecooltechguy
2023-12-07 09:53:10 +00:00
parent 22db5c9793
commit 5b10b505ba
8 changed files with 44 additions and 48 deletions
+2
View File
@@ -0,0 +1,2 @@
__pycache__/
*.pyc
+40
View File
@@ -1,2 +1,42 @@
# ComfyUI-MagicAnimate
Easily use Magic Animate within ComfyUI!
[![](https://dcbadge.vercel.app/api/server/MfVCahkc2y)](https://discord.gg/MfVCahkc2y)
<!-- table of contents -->
- [Installation](#1-installation)
- [Node types](#node-types)
- [Example workflows](#example-workflows)
- [Animate any person's image with a DeepPose video input](#animate-any-person's-image-with-a-DeepPose-video-input)
<!-- - [Animate any person's image using pose extracted from any video input](#animate-any-person's-image-using-pose-extracted-from-any-video-input) -->
Need help? <a href="https://discord.gg/hwwbNRAq6E">Join our Discord!</a>
## 1. Installation
```
cd ComfyUI/custom_nodes/
git clone https://github.com/thecooltechguy/ComfyUI-MagicAnimate
cd ComfyUI-MagicAnimate/
python -m pip install -r requirements.txt
python prestartup_script.py # This will download all the necessary model checkpoints
```
## Node types
- **MagicAnimateModelLoader**
- Loads the MagicAnimate model
- **MagicAnimate**
- Uses the MagicAnimate model to animate an input image using an input DeepPose video, and outputs the generated video
## Example workflows
### Animate any person's image with a DeepPose video input
[https://comfyworkflows.com/workflows/2e137168-91f7-414d-b3c6-23feaf704fdb](https://comfyworkflows.com/workflows/2e137168-91f7-414d-b3c6-23feaf704fdb)
![workflow graph](./workflow1_graph.png)
![sample output](./workflow1.gif)
<!-- ### Animate any person's image using pose extracted from any video input
[https://comfyworkflows.com/workflows/5a4cd9fd-9685-4985-adb8-7be84e8636ad](https://comfyworkflows.com/workflows/5a4cd9fd-9685-4985-adb8-7be84e8636ad)
![workflow graph](./svd_workflow_graph.png)
![sample output](./svd_workflow.gif) -->
Binary file not shown.
Binary file not shown.
+1 -47
View File
@@ -19,7 +19,6 @@ from magicanimate.utils.util import save_videos_grid
from magicanimate.utils.dist_tools import distributed_init
from accelerate.utils import set_seed
from collections import OrderedDict
# from magicanimate.utils.videoreader import VideoReader
class MagicAnimateModelLoader:
def __init__(self):
@@ -27,8 +26,6 @@ class MagicAnimateModelLoader:
@classmethod
def INPUT_TYPES(s):
# checkpoints = folder_paths.get_filename_list("checkpoints")
# vaes = folder_paths.get_filename_list("vae")
magic_animate_checkpoints = folder_paths.get_filename_list("magic_animate")
devices = []
@@ -38,16 +35,6 @@ class MagicAnimateModelLoader:
return {
"required": {
# "model" : (checkpoints, {
# "default" : checkpoints[0],
# }),
# "vae" : (vaes, {
# "default" : vaes[0]
# })
# "model": ("MODEL",),
# "clip" : ("CLIP",),
# "vae" : ("VAE",),
# "controlnet" : ("CONTROL_NET",),
"controlnet" : (magic_animate_checkpoints ,{
"default" : magic_animate_checkpoints[0]
}),
@@ -89,13 +76,6 @@ class MagicAnimateModelLoader:
motion_module = os.path.join(magic_animate_models_dir, motion_module)
config.motion_module = motion_module
# print(magic_animate_models_dir)
# print(config.pretrained_appearance_encoder_path)
# print(config.pretrained_model_path)
# print(config.pretrained_vae_path)
# print(config.pretrained_controlnet_path)
# print(config.motion_module)
### >>> create animation pipeline >>> ###
tokenizer = CLIPTokenizer.from_pretrained(config.pretrained_model_path, subfolder="tokenizer")
text_encoder = CLIPTextModel.from_pretrained(config.pretrained_model_path, subfolder="text_encoder")
@@ -249,6 +229,7 @@ class MagicAnimate:
prompt = ""
n_prompt = ""
control = pose_video.detach().cpu().numpy() # (num_frames, H, W, C)
# print("control shape:", control.shape)
if control.shape[1] != size or control.shape[2] != size:
# resize each frame in control to be (size, size)
@@ -290,41 +271,14 @@ class MagicAnimate:
return (sample,)
class MagicAnimateModelDebug:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"model": ("MAGIC_ANIMATE_MODEL",),
},
}
# RETURN_TYPES = ("MAGIC_ANIMATE_MODEL",)
FUNCTION = "load_model"
CATEGORY = "ComfyUI Magic Animate"
OUTPUT_NODE = True
RETURN_TYPES = ()
def load_model(self, model):
print(model)
return ()
# A dictionary that contains all nodes you want to export with their names
NODE_CLASS_MAPPINGS = {
"MagicAnimateModelLoader" : MagicAnimateModelLoader,
"MagicAnimate" : MagicAnimate,
"MagicAnimateModelDebug" : MagicAnimateModelDebug,
}
# A dictionary that contains the friendly/humanly readable titles for the nodes
NODE_DISPLAY_NAME_MAPPINGS = {
"MagicAnimateModelLoader" : "Load Magic Animate Model",
"MagicAnimate" : "Magic Animate",
"MagicAnimateModelDebug" : "Debug Magic Animate Model",
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB