AnimateDiff Evolved
A forked repository that actively maintains [a/AnimateDiff](https://github.com/ArtVentureX/comfyui-animatediff), created by ArtVentureX.
Nodes (145)
Per-block motion control, the simple version
Per-block motion control, split further
Stretching AnimateDiff's positional encoding past its training window
Hand-tuning AnimateDiff's positional encoding, index by index
Remapping AnimateDiff's positional encoding around its trained sweet spot
A flat offset dial for the motion module's weights
One dial that scales every weight in the motion module
Nudging AnimateDiff's PE, attention, and other weights independently
Additive offsets down to the Q/K/V level of AnimateDiff's attention
Scaling AnimateDiff's Q/K/V attention weights independently
Scaling AnimateDiff's PE, attention, and other weights separately
Controlling the noise ancestral samplers inject, frame by frame
Deprecated by its own author, use Video Combine (VHS) instead
Changing how strong the motion is partway through your clip
The current recommended one-node AnimateDiff setup
What it did, and what to use instead
The original one-node AnimateDiff loader
Camera-movement LoRAs, and why they don't always do much
Deprecated, and what it did
Deprecated, and what it did
Deprecated — here's why you'll see it in old workflows
What it did before PE/Weight Adjust replaced it
Where FreeNoise and the noise-scheduling tricks live
The bundle node for tweaking motion module internals
The older combined context-schedule node
Detaching the motion module from a model mid-graph
The Advanced Apply node — scheduling and stacking motion models
Turning a loaded motion module into something usable
Giving AnimateDiff an actual camera move
Image-conditioned motion, the Gen2 way
Turning a still image into your video's first frame
The node that actually turns a LoRA hook on
LoRAs that only apply to part of your prompt
Sliding-window sampling without a motion module
Scheduling camera-control strength across a clip
Stitching camera moves together by hand
Stacking camera moves
Your first camera move in AnimateDiff
Building a camera move for CameraCtrl, one segment at a time
Perturbed-Attention Guidance for AnimateDiff's sample settings
PAG for AnimateDiff
Taming overexposed, oversaturated high-CFG output
RescaleCFG for AnimateDiff
Merging scheduled LoRAs in AnimateDiff
Merging up to eight scheduled LoRAs
Merging multiple scheduled/masked LoRAs into one chain
Pulling a single step out of a prompt schedule
Merge two masked conditioning branches into one
Mask, strength, and schedule a conditioning branch
Masked, timed, LoRA-aware conditioning
Fill in everything your mask didn't cover
Keeping a sliding-window AnimateDiff render consistent
Schedule how hard the reference locks in
Batch-generate a ContextRef schedule
Ramp ContextRef's strength on a curve
Anchor every window to frame one
Pick your own reference windows
Sliding — anchoring long AnimateDiff generations
Dial in the attention-injection strength
Attention injection plus color and style matching
The cheap fix for sliding-window drift
Schedule the cheap consistency fix over time
Batch-generate a NaiveReuse schedule
Ramp NaiveReuse's strength on a curve
The node that actually turns ContextRef or NaiveReuse on
Override the sampler's CFG with a schedule or a mask
One point in a hand-built CFG schedule
Batch-generate a CFG schedule
Ramp CFG smoothly across the render
Scheduling your CFG scale to change mid-clip
Overriding your sampler's guidance in AnimateDiff-Evolved
Seeding huge AnimateDiff frame counts
Turning one number into a list ComfyUI will accept
Experimental, and the node's own name tells you
Turning a motion module into an image animator
Hand-tuning how strongly PIA follows your image
The PIA authors' own tuned motion-strength values
The plain baseline behind FreeInit
FreeInit for AnimateDiff, and why almost nobody plugs it in
Just loading the motion module, nothing else yet
Loading the motion module and camera weights together
Loading the fast, image-anchored motion module
Reusing a camera trajectory
Loading a camera trajectory from a file instead of building one by hand
The node for actual seamless loops
The view-window setting for clips that need to loop
Hand-placing a step in your LoRA's strength schedule
Scheduling a LoRA's strength over time
A smooth strength ramp instead of hand-placed steps
Pulling a plain mask back out of the pack's strength type
The value type behind almost every strength slider in this pack
Building a Multival from a per-frame source
A real per-frame list, driving motion strength over time
Remapping a mask's grayscale into a real strength range
Anchoring your animation to a real frame mid-sampling
Positioning where an injected image lands
Stacking extra noise into specific parts of your frame
Blending an extra noise source in at your own ratio
Stacking noise layers without babysitting the balance
Overriding noise in a region instead of blending it
Merging two positive/negative pairs in one step
Masking a positive/negative pair together
Mask, schedule, and fold a pair into your base conditioning in one step
Filling in what your masked pair didn't cover
Turning motion off in specific parts of the U-Net
Scripting all 21 SD1.5 motion blocks from two lists of numbers
Every one of SD1.5's 21 motion blocks, individually addressable
One control per SD1.5 UNet stage, instead of 21
Scripting all 16 SDXL motion blocks from two lists of numbers
Every one of SDXL's 16 motion blocks, individually addressable
One control per SDXL UNet stage, instead of 16
PAG as a direct model patch, with maskable strength
Scheduling image-conditioned motion in Gen2
Prompt travel without installing FizzNodes
Prompt travel that actually matches your frame count
Building a noise schedule from raw beta parameters
Loading a LoRA that only fires when you tell it to
Registering a LoRA hook when you don't need CLIP
Hooking an entire checkpoint in as if it were a LoRA
Hooking a checkpoint's UNet weights only
Tuning CameraCtrl's intrinsics
Telling CameraCtrl what resolution a pose was actually built for
RescaleCFG as a direct model patch, with maskable strength
Attaching a built keyframe schedule onto a LoRA hook
Matching your noise schedule to your motion model
Stitching two noise schedules together at a chosen point
Turning an abstract noise schedule into a concrete sigma list
Blending two noise schedules by weight
A noise-schedule blend that shifts over the course of sampling
Fixed chunks instead of a sliding window
The simplest of the three view-window nodes
The node that gave AnimateDiff unlimited length
The sliding-window middle ground between the other two View Options
Packaging a start/end percent window as a reusable object
Preparing a reference image for AnimateLCM-I2V
The node that actually does the work in a Gen2 chain
Scheduling a raw number across your clip, not just a prompt
Value scheduling that tracks your actual batch size
Giving a numeric schedule a name so Prompt Scheduling can find it
Sliding windows without the whole-UNet pass
See your sliding context windows before you pay for the run
Previewing context windows for a start/end step range
Previewing context windows against your own sigma schedule
The original one-node loader
The checkpoint loader that also fixes your beta schedule
AnimateDiff for ComfyUI
Improved AnimateDiff integration for ComfyUI, as well as advanced sampling options dubbed Evolved Sampling usable outside of AnimateDiff. Please read the AnimateDiff repo README and Wiki for more information about how it works at its core.
AnimateDiff workflows will often make use of these helpful node packs:
- ComfyUI-Advanced-ControlNet for making ControlNets work with Context Options and controlling which latents should be affected by the ControlNet inputs. Includes SparseCtrl support. Maintained by me.
- ComfyUI-VideoHelperSuite for loading videos, combining images into videos, and doing various image/latent operations like appending, splitting, duplicating, selecting, or counting. Actively maintained by AustinMroz and I.
- comfyui_controlnet_aux for ControlNet preprocessors not present in vanilla ComfyUI. Maintained by Fannovel16.
- ComfyUI_IPAdapter_plus for IPAdapter support. Maintained by cubiq (matt3o).
- ComfyUI-KJNodes for miscellaneous nodes including selecting coordinates for animated GLIGEN. Maintained by kijai.
- ComfyUI_FizzNodes for an alternate way to do prompt-travel functionality with the BatchPromptSchedule node. Maintained by FizzleDorf.
Installation
If using ComfyUI Manager:
- Look for
AnimateDiff Evolved, and be sure the author isKosinkadink. Install it.
If installing manually:
- Clone this repo into
custom_nodesfolder.
Model Setup:
- Download motion modules. You will need at least 1. Different modules produce different results.
- Original models
mm_sd_v14,mm_sd_v15,mm_sd_v15_v2,v3_sd15_mm: HuggingFace | Google Drive | CivitAI - Stabilized finetunes of mm_sd_v14,
mm-Stabilized_midandmm-Stabilized_high, by manshoety: HuggingFace - Finetunes of mm_sd_v15_v2,
mm-p_0.5.pthandmm-p_0.75.pth, by manshoety: HuggingFace - Higher resolution finetune,
temporaldiff-v1-animatediffby CiaraRowles: HuggingFace - FP16/safetensor versions of vanilla motion models, hosted by continue-revolution (takes up less storage space, but uses up the same amount of VRAM as ComfyUI loads models in fp16 by default): HuffingFace
- Original models
- Place models in one of these locations (you can rename models if you wish):
ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/modelsComfyUI/models/animatediff_models
- Optionally, you can use Motion LoRAs to influence movement of v2-based motion models like mm_sd_v15_v2.
- Google Drive | HuggingFace | CivitAI
- Place Motion LoRAs in one of these locations (you can rename Motion LoRAs if you wish):
ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/motion_loraComfyUI/models/animatediff_motion_lora
- Get creative! If it works for normal image generation, it (probably) will work for AnimateDiff generations. Latent upscales? Go for it. ControlNets, one or more stacked? You betcha. Masking the conditioning of ControlNets to only affect part of the animation? Sure. Try stuff and you will be surprised by what you can do. Samples with workflows are included below.
NOTE: you can also use custom locations for models/motion loras by making use of the ComfyUI extra_model_paths.yaml file. The id for motion model folder is animatediff_models and the id for motion lora folder is animatediff_motion_lora.
Features
- Compatible with almost any vanilla or custom KSampler node.
- ControlNet, SparseCtrl, and IPAdapter support
- Infinite animation length support via sliding context windows across whole unet (Context Options) and/or within motion module (View Options)
- Scheduling Context Options to change across different points in the sampling process
- FreeInit and FreeNoise support (FreeInit is under iteration opts, FreeNoise is in SampleSettings' noise_type dropdown)
- Mixable Motion LoRAs from original AnimateDiff repository implemented. Caveat: the original loras really only work on v2-based motion models like
mm_sd_v15_v2,mm-p_0.5.pth, andmm-p_0.75.pth.- UPDATE: New motion LoRAs without the v2 limitation can now be trained via the AnimateDiff-MotionDirector repo. Shoutout to ExponentialML for implementing MotionDirector for AnimateDiff purposes!
- Prompt travel using built-in Prompt Scheduling nodes, or BatchPromptSchedule node from ComfyUI_FizzNodes
- Scale and Effect multival inputs to control motion amount and motion model influence on generation.
- Can be float, list of floats, or masks
- Custom noise scheduling via Noise Types, Noise Layers, and seed_override/seed_offset/batch_offset in Sample Settings and related nodes
- AnimateDiff model v1/v2/v3 support
- Using multiple motion models at once via Gen2 nodes (each supporting
- HotshotXL support (an SDXL motion module arch),
hsxl_temporal_layers.safetensors.- NOTE: You will need to use
autoselectorlinear (HotshotXL/default)beta_schedule, the sweetspot for context_length or total frames (when not using context) is 8 frames, and you will need to use an SDXL checkpoint.
- NOTE: You will need to use
- AnimateDiff-SDXL support, with corresponding model. Still in beta after several months.
- NOTE: You will need to use
autoselectorlinear (AnimateDiff-SDXL)beta_schedule. Other than that, same rules of thumb apply to AnimateDiff-SDXL as AnimateDiff.
- NOTE: You will need to use
- AnimateLCM support
- NOTE: You will need to use
autoselectorlcmorlcm[100_ots]beta_schedule. To use fully with LCM, be sure to use appropriate LCM lora, use thelcmsampler_name in KSampler nodes, and lower cfg to somewhere around 1.0 to 2.0. Don't forget to decrease steps (minimum = ~4 steps), since LCM converges faster (less steps). Increase step count to increase detail as desired.
- NOTE: You will need to use
- AnimateLCM-I2V support, big thanks to Fu-Yun Wang for providing me the original diffusers code he created during his work on the paper
- NOTE: Requires same settings as described for AnimateLCM above. Requires
Apply AnimateLCM-I2V ModelGen2 node usage so thatref_latentcan be provided; useScale Ref Image and VAE Encodenode to preprocess input images. While this was intended as an img2video model, I found it works best for vid2vid purposes withref_drift=0.0, and to use it for only at least 1 step before switching over to other models via chaining with toher Apply AnimateDiff Model (Adv.) nodes. Theapply_ref_when_disabledcan be set to True to allow the img_encoder to do its thing even when theend_percentis reached. AnimateLCM-I2V is also extremely useful for maintaining coherence at higher resolutions (with ControlNet and SD LoRAs active, I could easily upscale from 512x512 source to 1024x1024 in a single pass). TODO: add examples
- NOTE: Requires same settings as described for AnimateLCM above. Requires
- CameraCtrl support, with the pruned model you must use here: CameraCtrl_pruned.safetensors
- NOTE: Requires AnimateDiff SD1.5 models, and was specifically trained for v3 model. Gen2 only, with helper nodes provided under Gen2/CameraCtrl submenu.
- PIA support, with the model pia.ckpt
- NOTE: You will need to use
autoselectorsqrt_linear (AnimateDiff)beta_schedule. RequiresApply AnimateDiff-PIA ModelGen2 node usage if you want to actually provide input images. Thepia_inputcan be provided via the paper's presets (PIA Input [Paper Presets]) or by manually entering values (PIA Input [Multival]).
- NOTE: You will need to use
- AnimateDiff Keyframes to change Scale and Effect at different points in the sampling process.
- fp8 support; requires newest ComfyUI and torch >= 2.1 (decreases VRAM usage, but changes outputs)
- Mac M1/M2/M3 support
- Usage of Context Options and Sample Settings outside of AnimateDiff via Gen2 Use Evolved Sampling node
- Maskable and Schedulable SD LoRA (and Models as LoRA) for both AnimateDiff and StableDiffusion usage via LoRA Hooks
- Per-frame GLIGEN coordinates control
- Currently requires GLIGENTextBoxApplyBatch from KJNodes to do so, but I will add native nodes to do this soon.
- Image Injection mid-sampling
- ContextRef and NaiveReuse (novel cross-context consistency techniques)
Upcoming Features
- Example workflows for every feature in AnimateDiff-Evolved repo, nodes will have usage descriptions (currently Value/Prompt Scheduling nodes have them), and YouTube tutorials/documentation
- UniCtrl support
- Unet-Ref support so that a bunch of papers can be ported over
- StoryDiffusion implementation
- Merging motion model weights/components, including per block customization
- Maskable Motion LoRA
- Timestep schedulable GLIGEN coordinates
- Dynamic memory management for motion models that load/unload at different start/end_percents
- Anything else AnimateDiff-related that comes out
Basic Usage and Nodes
Samples
Known Issues
Some motion models have visible watermark on resulting images (especially when using mm_sd_v15)
Training data used by the authors of the AnimateDiff paper contained Shutterstock watermarks. Since mm_sd_v15 was finetuned on finer, less drastic movement, the motion module attempts to replicate the transparency of that watermark and does not get blurred away like mm_sd_v14. Using other motion modules, or combinations of them using Advanced KSamplers should alleviate watermark issues.