- Fixing errors when using the AnimateDiff motion module
- Troubleshooting errors when generating video with AnimateDiff
EinopsError: Error while processing rearrange-reduction pattern "(b f) d c -> (b d) f c". Input tensor shape: torch.Size([2, 4096, 320]). Additional info: {'f': 16}. Shape mismatch, can't divide axis of length 2 in chunks of 16 |
▲Provides solutions to the error message above

First attempt
Use the latest version
Make sure you are using the latest version of the model and library. Update to the latest version using the following command:
pip install --upgrade einops pip install --upgrade torch |
Check GitHub Issues
There is currently a similar issue being discussed on GitHub regarding this issue.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. torchvision 0.18.1 requires torch==2.3.1, but you have torch 2.6.0 which is incompatible. xformers 0.0.27 requires torch==2.3.1, but you have torch 2.6.0 which is incompatible. |
This error occurs due to a version mismatch in the torch package.
Remove conflicting packages
First, remove the torch, torchvision, and xformers packages. Open a terminal (or command prompt) and run the following command:
pip uninstall torch torchvision xformers |
Install the correct version of the package
Then, install torch 2.3.1 and its compatible torchvision and xformers.
pip install torch==2.3.1 torchvision==0.18.1 pip install xformers==0.0.27 |
Second attempt
1. Check and remove currently installed packages
Uninstall the currently installed torch, torchvision, and xformers packages. Open a terminal (or command prompt) and run the following commands:
pip uninstall torch torchvision |
2. Install a specific version of torch
Install torch 2.3.1 and its compatible torchvision and xformers.
pip install torch==2.3.1 pip install torchvision==0.18.1 pip install xformers==0.0.27 |
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. basicsr 1.4.2 requires torchvision, which is not installed. clean-fid 0.1.35 requires torchvision, which is not installed. facexlib 0.3.0 requires torchvision, which is not installed. gfpgan 1.3.8 requires torchvision, which is not installed. open-clip-torch 2.31.0 requires torchvision, which is not installed. realesrgan 0.3.0 requires torchvision, which is not installed. timm 1.0.15 requires torchvision, which is not installed. torchaudio 2.6.0 requires torch==2.6.0, but you have torch 2.3.1 which is incompatible. |
Error message appears again;;;
Third attempt
1. Check and remove currently installed packages
Remove all currently installed packages. Open a terminal (or command prompt) and run the following command:
pip uninstall torch torchvision torchaudio xformers basicsr clean-fid facexlib gfpgan open-clip-torch realesrgan timm |
2. Install the correct version of the package
Now install compatible versions of torch and other dependency packages.
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pip install xformers==0.0.27 pip install basicsr==1.4.2 clean-fid==0.1.35 facexlib==0.3.0 gfpgan==1.3.8 open-clip-torch==2.31.0 realesrgan==0.3.0 timm==1.0.15 |
getting this error: [ EinopsError: Error while processing rearrange-reduction pattern "(b f) d c -> (b d) f c". Input tensor shape: torch.Size([2, 4096, 320]). Additional info: {'f': 16}. Shape mismatch, can't divide axis of length 2 in chunks of 16]. |
Still It's so frustrating…
I hereby decide that this method is wrong.
Fourth attempt
Update AUTOMATIC1111
1. Update using Git
The simplest way is to update using Git. Follow these steps:
Open the Stable Diffusion Web UI folder:
Open the stable-diffusion-webui folder in File Explorer.
Open a terminal:
Right-click inside the folder and select "Open in Terminal."
If you don't have the "Open in Terminal" option, open a command prompt and use the cd command to navigate to the stable-diffusion-webui directory.
Run the Git Pull command:
In your terminal, run the following command to update to the latest version:
2. Set up automatic updates
To set up automatic updates, you can edit the webui-user.bat file to add a Git Pull command:
Edit the webui-user.bat file:
Open the webui-user.bat file in the stable-diffusion-webui folder and add the following:
@echo off set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS= git pull call webui.bat |
If the upgrade fails, upgrade manually.
1. Check the latest version using Git
First, upgrade to the latest version using Git.
Open the Stable Diffusion Web UI folder:
In File Explorer, navigate to the stable-diffusion-webui folder.
Open a terminal:
Right-click inside the folder and select "Open in Terminal" or "Open in Command Prompt."
If you don't have the "Open in Terminal" option, open a command prompt and use the cd command to navigate to the stable-diffusion-webui directory.
Run the Git Pull command:
In the terminal, run the following command to update to the latest version:
2. Update Python packages
Update the required Python packages to ensure compatibility with the latest versions.
Update Python dependency files:
If you have a requirements_versions.txt file, update it:
pip install -r requirements_versions.txt |
Manually updating Python packages:
You can manually update Python packages as needed. For example:
pip install --upgrade torch torchvision |
remote: Enumerating objects: 6, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (5/5), done. remote: Total 6 (delta 1), reused 0 (delta 0), pack-reused 1 (from 1) Unpacking objects: 100% (6/6), 8.90 KiB | 350.00 KiB/s, done. From https://github.com/AUTOMATIC1111/stable-diffusion-webui d8688def..374bb6cc dev -> origin/dev You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details. |
When the AUTOMATIC1111 Web UI update error message appears:
This message means that you are not on the current branch and you need to specify which branch to merge into. You can fix the problem by following the steps below.
Run the git pull command immediately after master
—------------------------------------------------------------------------------------------------------------------------
Update to the latest version
Update Python Packages
Update the required Python packages to ensure compatibility with the latest versions.
pip install -r requirements_versions.txt |
Manually update Python packages: You can manually update Python packages as needed.
pip install --upgrade torch torchvision |
Problem solved!
