Wan 2.2 Local Deployment: ComfyUI, VRAM Sizing, and Video Generation Troubleshooting

Deploy Wan 2.2 locally with ComfyUI or Diffusers, select the right model, prepare CUDA and VRAM, download weights, validate output, and diagnose common failures.

Wan 2.2 is a series of open source video generation models released by the Alibaba Wan-Video team. wan 2.2 appears in the “AI video” rising query in Google Trends US. However, the most common pitfall in local deployment is not the startup command, but the downloading of model variants that are not suitable for VRAM and workflow. This article first explains the model family, and then gives the ComfyUI and Python routes respectively. All memory figures should be re-verified with the specific model card, resolution and offload settings.

Identify the model name

before downloading The Wan 2.2 repository may list different tasks such as text generation video, image generation video, TI2V, Animate, S2V, etc. at the same time. There may also be different parameter scales, MoEs, or quantized versions of the same task. Just because the model file names are similar does not mean that they can be put into the same workflow node. First record four pieces of information in the official README:

  • Task type.
  • Parameter scale and architecture.
  • Recommended resolution.
  • Official reasoning entrance.

Do not download dozens of GB files first and then guess the purpose of the model based on the error message.

VRAM planning is based on peak value rather than model file size

Model weights are only part of the VRAM. Inference also requires text encoders, VAEs, activations, attention caches, and output tensors. Resolution, number of frames, batch size and sampling steps will all change the peak value. CPU offload reduces VRAM but increases system memory and PCIe transfers. Quantization can reduce weight occupancy, but it does not necessarily reduce all activations year-on-year. Don’t budget with “the model file is 14 GB, so a 16 GB graphics card must be enough”.

Choose between three hardware paths

NVIDIA graphics cards above 24 GB are suitable for starting from the official more complete workflow. 12–16 GB graphics cards require selecting smaller model, quantization, lower resolution, or CPU offload. The 8 GB graphics card is more suitable for short films, low-resolution experiments, and is not suitable as a stable production baseline. Multi-card is only effective when explicitly supported by the inference framework, and cannot be automatically merged by setting CUDA_VISIBLE_DEVICES=0,1. Pure CPU can verify the environment and nodes, but the generation speed is usually impractical. Support for AMD, Intel and Apple Silicon is subject to the official repository and framework version.

Check NVIDIA driver and CUDA visibility

1
nvidia-smi

Record the driver version, graphics card model, total VRAM and current usage. Check PyTorch again in Python environment:

1
python -c "import torch; print(torch.__version__); print(torch.cuda.is_available()); print(torch.version.cuda); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU')"

If nvidia-smi is normal but torch.cuda.is_available() is false, it usually means that PyTorch has installed the CPU version or the environment is wrong. Do not reinstall the graphics card driver repeatedly to hide Python virtual environment problems.

Create a standalone Python environment for Wan 2.2

1
2
3
python -m venv .venv-wan22
.\.venv-wan22\Scripts\Activate.ps1
python -m pip install --upgrade pip setuptools wheel

Linux:

1
2
3
python3 -m venv .venv-wan22
source .venv-wan22/bin/activate
python -m pip install --upgrade pip setuptools wheel

Don’t cram ComfyUI, custom nodes, and standalone Diffusers projects into the same global Python. When dependencies conflict, an isolated environment is easier to recover than a forced downgrade of the entire system.

Clone the official repository and lock commit

1
2
3
git clone https://github.com/Wan-Video/Wan2.2.git
cd Wan2.2
git rev-parse HEAD

First read the current README for installation commands and model tables.

1
2
git status --short
git log -1 --oneline

When tutorials are out of sync with repository updates, the commit SHA can tell you which version you are actually using. Don’t track unverified PR branches until they succeed the first time.

Match PyTorch to a supported CUDA build

when installing PyTorch First go to the official PyTorch installation page to select the operating system, package manager and CUDA version. The example command cannot be copied without the current driver:

1
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

cu128 is just an example, confirm Wan 2.2 and dependency support before execution. After installation, run the CUDA visibility check again. Then install the dependencies according to the repository requirements:

1
pip install -r requirements.txt

The model download directory must have enough space

Weights, text encoders, VAEs, and caches can take up tens of GB. Check before downloading:

1
2
df -h
du -sh ~/.cache/huggingface 2>/dev/null || true

Windows:

1
Get-PSDrive -PSProvider FileSystem

Put the Hugging Face cache to a large disk:

1
$env:HF_HOME = "D:\hf-cache"

When the environment variable only takes effect for the current terminal, opening a new window will re-download it to the default location.

Download the selected model repository with Hugging Face CLI

1
2
pip install -U "huggingface_hub[cli]"
huggingface-cli login

Only download repositories listed on the official model card and do not use unknown images with similar names.

1
2
huggingface-cli download <official-model-repository> \
  --local-dir ./models/wan22

Replace the placeholder with the model ID currently given in the official README. Save the file list and size after downloading:

1
find ./models/wan22 -type f -printf '%P %s\n' | sort > wan22-files.txt

ComfyUI route: update the core first and then install the node

Back up existing ComfyUI:

1
2
git -C ComfyUI status --short
git -C ComfyUI rev-parse HEAD

Do not pull directly when there are user modifications. Test the updated version in a new directory, or save the patch first.

1
2
3
git clone https://github.com/comfyanonymous/ComfyUI.git ComfyUI-Wan22
cd ComfyUI-Wan22
python -m pip install -r requirements.txt

Wan 2.2 native node support is subject to the current version of ComfyUI and the official workflow.

The model file must be placed in the directory actually read by the node

Common directories of ComfyUI include:

1
2
3
4
ComfyUI/models/diffusion_models/
ComfyUI/models/text_encoders/
ComfyUI/models/vae/
ComfyUI/models/clip_vision/

Different workflows have different requirements for directories and file types. Do not put all files into checkpoints. After opening the workflow, there is no model in the node drop-down box. First check the scan path in the ComfyUI startup log. Restart ComfyUI and refresh the browser.

Use additional model paths to avoid duplicating disk usage

You can point to the unified model library at extra_model_paths.yaml.

1
2
3
4
5
6
wan22:
  base_path: D:/ai-models/wan22
  diffusion_models: diffusion_models
  text_encoders: text_encoders
  vae: vae
  clip_vision: clip_vision

It is recommended to use forward slashes in Windows paths to reduce YAML escaping problems. After modification, confirm from the startup log that the new path is loaded. When the shared directory is set to read-only, custom nodes cannot be automatically downloaded or renamed there.

After importing the official workflow, first check for missing nodes

Workflow JSON may rely on specific ComfyUI versions or custom nodes. When you see a red node, record the node class name first. Only install corresponding nodes from trusted repositories and do not let the Manager install all search results in batches. After installation, record the repository URL and commit:

1
2
git -C custom_nodes/<node-directory> remote -v
git -C custom_nodes/<node-directory> rev-parse HEAD

Custom nodes have permission to execute native Python and should be reviewed like normal software.

Start the first generation with low-cost settings

Start by choosing the lower resolution recommended by the model. The frame rate is controlled within the official sample range. batch size is set to 1. The sampling step uses sample values first and does not pursue the maximum. Fixed seed to facilitate comparison of configuration changes. Cue words describe a subject, an action, and a simple shot. The goal of the first round is to validate the data flow, not to produce a final product.

Structure prompts for text-to-video generation

1
2
3
4
A red bicycle parked beside a quiet lake at sunrise.
Light fog moves slowly above the water.
The camera performs a gentle left-to-right pan.
Natural colors, realistic motion, no text, no watermark.

Too many subjects can make consistency more difficult. Actions, shots, and environments are described separately, making them easier to reproduce than stacking style words. If the model supports negative prompts, put constraints such as deformation, text, and low quality on the corresponding input, and do not guess grammar at the end of the main prompt word.

Prepare the input canvas for image-to-video generation

The input image should be close to the target aspect ratio. Don’t keep the body close to the edges, leaving room for movement. Alpha processing of transparent PNGs depends on the workflow, compositing the background first if necessary. EXIF rotation may cause the actual pixel orientation to differ from the preview.

1
2
3
4
5
6
from PIL import Image, ImageOps

image = Image.open("input.jpg")
image = ImageOps.exif_transpose(image).convert("RGB")
image.save("input-normalized.png")
print(image.size)

After standardization, put it into the workflow.

If the VRAM is insufficient, first check at which stage the peak occurs

Text encoder stage OOM, diffusion stage OOM and VAE decoding stage OOM are handled differently. View the log for the last loaded component.

1
nvidia-smi -l 1

Lowering the resolution and frame rate is most effective to activate VRAM. Enabling model or text encoder CPU offload increases memory usage. VAE tiled decode can alleviate decoding peaks, but may add seams or be time consuming. Don’t change five settings at the same time as soon as you encounter OOM.

Windows page file and system memory

CPU offload can consume large amounts of RAM. When the system is low on memory, Windows uses the page file, which may slow down the generation process. Check Commit and disk activity in Task Manager. Place the page file on an SSD with sufficient space and set a reasonable upper limit. Do not start large model downloads and offloads when there are only a few GB left on the system disk.

Completely release the process after CUDA out of memory

Some failed workflows retain VRAM. Stopping the ComfyUI queue does not necessarily free the Python process.

1
2
nvidia-smi
Get-Process python -ErrorAction SilentlyContinue

Confirm that the PID belongs to this ComfyUI before ending the process. Do not kill Python for other users or training tasks. After restarting, only change one parameter to verify.

No module named Usually the startup environment is inconsistent

Confirm the Python used by ComfyUI:

1
2
import sys
print(sys.executable)

Portable versions of ComfyUI may come with standalone Python. Installing dependencies on the system Python will not automatically enter a portable environment. Use the python -m pip install ... of that environment instead of the bare pip.

shape mismatch is mostly a mixture of model components

Check if diffusion model, VAE, text encoder and workflow are from the same model family. Components of Wan 2.1 should not be guessed based on file names to be fully compatible with Wan 2.2. The quantified weight also needs to correspond to the loader node. Return to the official workflow and complete the minimum verification of the complete precision components, and then replace them one by one. Don’t force load the video model by ignoring state dict errors.

Black video first eliminates encoder problems

Confirm whether the generated frame is normal before judging MP4 encoding. Export frames as PNG to check. When FFmpeg is not present or the encoder fails, the preview may be empty but the inference results are still there.

1
2
ffmpeg -version
ffprobe -v error -show_streams output.mp4

If the PNG is also completely black, check the VAE, precision, and input range again.

Measure generation speed per usable frame

Record the second run after warm-up. Save model, resolution, frame number, steps, seed, GPU, peak VRAM and total time taken.

1
seconds_per_generated_frame = total_seconds / output_frames

The first pass involves model loading and cannot be directly compared to the cached second pass. Reduced GPU utilization after turning on offload is not necessarily an error, it may be waiting for memory transfers.

Validate the output with ffprobe

1
2
3
4
ffprobe -v error \
  -show_entries stream=codec_name,width,height,r_frame_rate,nb_frames \
  -show_entries format=duration,size \
  -of json output.mp4

Confirm that the resolution, frame rate, number of frames, and duration comply with the workflow. Just because the browser can play it does not mean that the encoding parameters are suitable for the editing software. Convert to explicit H.264 or intermediate encoding when post-processing is required.

Prevent batch queues from filling the disk

Each video may produce preview, temporary frames and final MP4. Set space warning for the output directory. Estimate the maximum number of products before starting the task. Temporary directories for failed tasks are set to expire after cleaning, but are not deleted while still in use by the Python process. The file name contains the job ID, model and seed to avoid overwriting.

Custom node upgrade adopts rollback method

1
2
3
git -C custom_nodes/example status --short
git -C custom_nodes/example rev-parse HEAD
git -C custom_nodes/example pull --ff-only

Save the workflow JSON before upgrading. Fall back to the recorded commit when a new version fails, rather than randomly installing another fork. Do not upgrade the ComfyUI core, nodes, and models all on the same day.

Risks of opening ComfyUI remotely

ComfyUI and custom nodes are generally not designed for unauthenticated public networks. By default, only the loopback address is monitored. Remote access using VPN or SSH tunnel:

1
ssh -L 8188:127.0.0.1:8188 user@gpu-server

Do not map port 8188 directly to the public network. Uploaded materials may contain faces, customer videos, and copyrighted content, and remote storage requires access control and cleanup policies.

Publish workflows with a dependency manifest

when publishing workflow Just sharing JSON is not enough to reproduce. Also recorded:

  • ComfyUI commit.
  • Custom node repository and commit.
  • Model repository and file name.
  • Python, PyTorch and CUDA versions.
  • Resolution, number of frames, steps and seed.
  • Whether to use quantization and offload.

Do not share the model files themselves to bypass license or access restrictions.

Preserve a baseline before upgrading Wan 2.2

once before updating Wan 2.2 Prepare fixed images, prompts, seeds and workflows. After the upgrade, the same task is generated and the peak VRAM, time consumption, output size and key frames are compared. Model randomness means the footage won’t be exactly the same as in pixel testing. Focus on checking whether it can be completed, whether there are abnormal flickers and motion crashes. When performance degrades, roll back the model, node, and PyTorch respectively to locate which layer the change is.

Local deployment completion standard

  • CUDA is visible in the target virtual environment.
  • Model tasks are consistent with workflow types.
  • ComfyUI discovers all components.
  • The first low-resolution video can be completed.
  • OOM stages and peak memory are recorded.
  • The ffprobe output parameters are correct.
  • Custom node sources and commits are traceable.
  • The remote port is not directly exposed to the public network.
  • The fixed baseline is available for future upgrades.

The local deployment of Wan 2.2 does not end with putting the weights into a directory. Only by verifying model components, workflow, VRAM, and media output separately can we distinguish download errors, node incompatibilities, CUDA issues, and true model capability limitations.

Project resources