适用环境:Stable Diffusion WebUI Forge
适用显卡:NVIDIA RTX 3060 6GB(其他显卡同理)
最后更新时间:2026年3月19日
作者:一位亲自踩遍所有坑的勇士


📦 一、准备工作

1.1 确认你的 Forge 版本

打开 Forge 界面,看右下角版本号。本教程适用于:

  • f2.0.1v1.10.1-previous-xxx 等旧版 Forge

  • 新版 Forge 可能不需要手动修复

1.2 确认 Python 和 PyTorch

cmd

cd /d D:\webui_forge\webui
venv\Scripts\python.exe --version
# 必须是 3.10.x

venv\Scripts\python.exe -c "import torch; print(torch.__version__)"
# 建议 2.1.2+cu121

🔌 二、安装 AnimateDiff 插件

2.1 克隆插件(不要用内置安装,用 git)

cmd

cd /d D:\webui_forge\webui\extensions
rmdir /s /q sd-webui-animatediff
git clone https://github.com/continue-revolution/sd-webui-animatediff.git

⚠️ 注意:不要用 sd-forge-animatediff,那个可能不兼容旧版 Forge。

2.2 安装依赖

cmd

cd /d D:\webui_forge\webui
venv\Scripts\activate
pip install imageio[ffmpeg] av

📁 三、下载模型文件

3.1 创建模型文件夹

cmd

mkdir D:\webui_forge\webui\models\AnimateDiff

3.2 下载 V3 模型(6GB 显存优化版)

3.3 可选:下载 MotionLoRA(控制镜头移动)

  • v2_lora_PanLeft.ckpt(左移)

  • v2_lora_ZoomIn.ckpt(推近)

  • 放到同一目录


⚠️ 四、常见错误及修复(核心踩坑记录)

4.1 错误:No module named 'diffusers.modeling_utils'

原因:diffusers 版本太高,与旧版 Forge 不兼容。

修复

cmd

cd /d D:\webui_forge\webui
venv\Scripts\activate
pip uninstall diffusers -y
pip install diffusers==0.21.4

4.2 错误:No module named 'ldm' / No module named 'modules.attention'

原因:插件代码里导入路径写死了,但你的 Forge 里路径不一样。

修复(通用方法):

  1. 写一个搜索脚本 find_class.py

python

import os
import sys

root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, root)

class_name = input("输入要搜索的类名(如 FeedForward): ")

for dirpath, dirnames, filenames in os.walk(root):
    if 'venv' in dirpath or 'extensions' in dirpath:
        continue
    for filename in filenames:
        if filename.endswith('.py'):
            filepath = os.path.join(dirpath, filename)
            try:
                with open(filepath, 'r', encoding='utf-8') as f:
                    content = f.read()
                    if f'class {class_name}' in content:
                        rel_path = os.path.relpath(filepath, root)
                        import_path = rel_path.replace('\\', '.').replace('/', '.').replace('.py', '')
                        print(f"找到 {class_name} 了!在: {filepath}")
                        print(f"对应的导入路径是: from {import_path} import {class_name}")
            except:
                pass
  1. 运行脚本

cmd

cd /d D:\webui_forge\webui
venv\Scripts\python.exe find_class.py

输入 FeedForward,得到正确路径。

  1. 修改插件文件

cmd

notepad D:\webui_forge\webui\extensions\sd-webui-animatediff\motion_module.py

把 from ldm.modules.attention import FeedForward 改成脚本找到的路径,例如:

python

from backend.nn.unet import FeedForward

4.3 错误:扩展列表里有插件,但界面不显示

原因:配置文件损坏或扩展被禁用。

修复

  1. 打开 D:\webui_forge\webui\config.json

  2. 确保 "disable_all_extensions": "none"

  3. 删除 "disabled_extensions" 里的插件名

  4. 保存,重启

4.4 错误:No module named 'tqdm.auto'

原因:虚拟环境损坏,基础库缺失。

修复(终极手段):

cmd

cd /d D:\webui_forge\webui
rmdir /s /q venv

然后重启 Forge,让它自动重建虚拟环境。

AnimateDiff Forge 插件完美安装教程(踩坑实录版)

适用环境:Stable Diffusion WebUI Forge
适用显卡:NVIDIA RTX 3060 6GB(其他显卡同理)
最后更新时间:2026年3月19日
作者:一位亲自踩遍所有坑的勇士


📦 一、准备工作

1.1 确认你的 Forge 版本

打开 Forge 界面,看右下角版本号。本教程适用于:

  • f2.0.1v1.10.1-previous-xxx 等旧版 Forge

  • 新版 Forge 可能不需要手动修复

1.2 确认 Python 和 PyTorch

cmd

cd /d D:\webui_forge\webui
venv\Scripts\python.exe --version
# 必须是 3.10.x

venv\Scripts\python.exe -c "import torch; print(torch.__version__)"
# 建议 2.1.2+cu121

🔌 二、安装 AnimateDiff 插件

2.1 克隆插件(不要用内置安装,用 git)

cmd

cd /d D:\webui_forge\webui\extensions
rmdir /s /q sd-webui-animatediff
git clone https://github.com/continue-revolution/sd-webui-animatediff.git

⚠️ 注意:不要用 sd-forge-animatediff,那个可能不兼容旧版 Forge。

2.2 安装依赖

cmd

cd /d D:\webui_forge\webui
venv\Scripts\activate
pip install imageio[ffmpeg] av

📁 三、下载模型文件

3.1 创建模型文件夹

cmd

mkdir D:\webui_forge\webui\models\AnimateDiff

3.2 下载 V3 模型(6GB 显存优化版)

3.3 可选:下载 MotionLoRA(控制镜头移动)

  • v2_lora_PanLeft.ckpt(左移)

  • v2_lora_ZoomIn.ckpt(推近)

  • 放到同一目录


⚠️ 四、常见错误及修复(核心踩坑记录)

4.1 错误:No module named 'diffusers.modeling_utils'

原因:diffusers 版本太高,与旧版 Forge 不兼容。

修复

cmd

cd /d D:\webui_forge\webui
venv\Scripts\activate
pip uninstall diffusers -y
pip install diffusers==0.21.4

4.2 错误:No module named 'ldm' / No module named 'modules.attention'

原因:插件代码里导入路径写死了,但你的 Forge 里路径不一样。

修复(通用方法):

  1. 写一个搜索脚本 find_class.py

python

import os
import sys

root = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, root)

class_name = input("输入要搜索的类名(如 FeedForward): ")

for dirpath, dirnames, filenames in os.walk(root):
    if 'venv' in dirpath or 'extensions' in dirpath:
        continue
    for filename in filenames:
        if filename.endswith('.py'):
            filepath = os.path.join(dirpath, filename)
            try:
                with open(filepath, 'r', encoding='utf-8') as f:
                    content = f.read()
                    if f'class {class_name}' in content:
                        rel_path = os.path.relpath(filepath, root)
                        import_path = rel_path.replace('\\', '.').replace('/', '.').replace('.py', '')
                        print(f"找到 {class_name} 了!在: {filepath}")
                        print(f"对应的导入路径是: from {import_path} import {class_name}")
            except:
                pass
  1. 运行脚本

cmd

cd /d D:\webui_forge\webui
venv\Scripts\python.exe find_class.py

输入 FeedForward,得到正确路径。

  1. 修改插件文件

cmd

notepad D:\webui_forge\webui\extensions\sd-webui-animatediff\motion_module.py

把 from ldm.modules.attention import FeedForward 改成脚本找到的路径,例如:

python

from backend.nn.unet import FeedForward

4.3 错误:扩展列表里有插件,但界面不显示

原因:配置文件损坏或扩展被禁用。

修复

  1. 打开 D:\webui_forge\webui\config.json

  2. 确保 "disable_all_extensions": "none"

  3. 删除 "disabled_extensions" 里的插件名

  4. 保存,重启

4.4 错误:No module named 'tqdm.auto'

原因:虚拟环境损坏,基础库缺失。

修复(终极手段):

cmd

cd /d D:\webui_forge\webui
rmdir /s /q venv

然后重启 Forge,让它自动重建虚拟环境。

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐