ComfyUI  >  Nodes  >  AnimateDiff >  Animate Diff Sampler

ComfyUI Node: Animate Diff Sampler

Class Name


Animate Diff
ArtVentureX (Account age: 414 days)
Latest Updated
Github Stars

How to Install AnimateDiff

Install this extension via the ComfyUI Manager by searching for  AnimateDiff
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter AnimateDiff in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Animate Diff Sampler Description

Facilitates animated sequence generation with motion dynamics in diffusion model framework for high-quality animations.

Animate Diff Sampler:

The AnimateDiffSampler node is designed to facilitate the generation of animated sequences by leveraging a motion module within a diffusion model framework. This node extends the capabilities of the KSampler to handle temporal data, allowing for the creation of coherent and smooth animations. It ensures that the motion module is correctly injected and managed during the sampling process, and it supports sliding window techniques to handle longer sequences efficiently. The primary goal of this node is to provide a seamless and efficient way to generate high-quality animations by integrating motion dynamics into the diffusion process.

Animate Diff Sampler Input Parameters:


This parameter specifies the motion module to be used in the animation process. The motion module is responsible for encoding the motion dynamics that will be applied to the generated frames, ensuring smooth transitions and realistic motion in the animation.


This parameter determines the method used to inject the motion module into the model. It can take values such as "default" or "legacy", which dictate different injection strategies. The choice of injection method can affect the quality and characteristics of the generated animation.


This parameter defines the number of frames to be generated in the animation. It accepts an integer value with a default of 16, a minimum of 2, and a maximum of 10000. The frame number directly impacts the length of the generated animation, with more frames resulting in longer sequences.


This parameter sets the random seed for the sampling process, ensuring reproducibility of the generated animation. By using the same seed, you can generate identical animations across different runs.


This parameter specifies the number of diffusion steps to be performed during the sampling process. More steps generally lead to higher quality results but at the cost of increased computation time.


This parameter stands for "classifier-free guidance" and controls the strength of the guidance applied during sampling. Higher values result in stronger guidance, which can improve the fidelity of the generated animation to the desired attributes.


This parameter indicates the name of the sampler to be used in the diffusion process. Different samplers can have varying effects on the quality and characteristics of the generated animation.


This parameter defines the scheduler to be used for the diffusion process. The scheduler controls the timing and progression of the diffusion steps, impacting the overall quality and coherence of the animation.


This parameter provides the positive conditioning information for the sampling process. It helps guide the generation towards desired attributes or features in the animation.


This parameter provides the negative conditioning information for the sampling process. It helps steer the generation away from undesired attributes or features in the animation.


This parameter contains the initial latent image data to be used as the starting point for the sampling process. It is a crucial input that influences the initial state of the generated animation.


This parameter controls the level of denoising applied during the sampling process. It accepts a float value with a default of 1.0. Higher values result in more denoising, which can affect the sharpness and clarity of the generated animation.


This optional parameter provides the sliding window options for handling longer sequences. It includes settings such as context length, stride, overlap, and schedule, which help manage the generation of long animations by breaking them into manageable chunks.

Animate Diff Sampler Output Parameters:


The output parameter samples contains the generated frames of the animation. Each frame is represented as a latent image, and the collection of these frames forms the complete animation sequence. The quality and coherence of the animation depend on the input parameters and the motion module used.

Animate Diff Sampler Usage Tips:

  • To achieve smoother animations, experiment with different inject_method values to find the one that best suits your needs.
  • Adjust the frame_number parameter to control the length of your animation. Keep in mind that longer animations require more computational resources.
  • Use the sliding_window_opts parameter to handle longer sequences efficiently, especially when generating animations with a high frame_number.
  • Fine-tune the cfg parameter to balance the strength of guidance and the naturalness of the generated animation.

Animate Diff Sampler Common Errors and Solutions:

ValueError: AnimateDiff model {motion_module.mm_type} has upper limit of {motion_module.encoding_max_len} frames, but received {error}.

  • Explanation: This error occurs when the specified frame_number or context_length exceeds the maximum encoding length supported by the motion module.
  • Solution: Reduce the frame_number or adjust the context_length in the sliding_window_opts to be within the supported limits of the motion module.

RuntimeError: CUDA out of memory.

  • Explanation: This error indicates that the GPU does not have enough memory to handle the specified parameters and the size of the animation.
  • Solution: Reduce the frame_number, steps, or other parameters that increase memory usage. Alternatively, try using a GPU with more memory.

KeyError: 'sliding_window_opts'

  • Explanation: This error occurs when the sliding_window_opts parameter is not provided but is required for the specified configuration.
  • Solution: Ensure that the sliding_window_opts parameter is correctly specified when needed, especially for longer animations.

Animate Diff Sampler Related Nodes

Go back to the extension to check out more related nodes.

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.