Workflow Wan 2.2 ComfyUI: cách thiết lập 5B và 14B, file model và cách sửa lỗi

https://tramcongngheai.com/

🇬🇧 Read in English

Wan 2.2 chạy trong ComfyUI qua hai mẫu (template) chính thức. Mẫu 5B là một model duy nhất làm được cả text-to-video lẫn image-to-video. Mẫu 14B dùng hai model: model noise cao cho nửa đầu các bước lấy mẫu (sampling) và model noise thấp cho nửa sau. Bài này chỉ cho bạn sơ đồ node thật, các file model chính xác cùng dung lượng, và những lỗi gặp phải khi thiếu file, tất cả lấy từ một bản cài ComfyUI mới tinh. Đây là hướng dẫn workflow Wan 2.2 ComfyUI đầy đủ nhất mà chúng mình có.

Quick answer: update ComfyUI, open the template video_wan2_2_5B_ti2v (or video_wan2_2_14B_t2v), download the model files listed below into models/diffusion_models, models/text_encoders and models/vae, then run it. The 5B setup needs about 18 GB of downloads. The 14B fp8 setup needs about 36 GB, or 38 GB with the 4-step LoRAs.

Chúng mình đã thử thế nào: chúng mình cài ComfyUI 0.38.0 (commit 65787d6, 1/10/2026) cùng workflow templates 0.11.74 trong một container. Máy thử của chúng mình không có GPU NVIDIA, nên ComfyUI chạy với --cpu. Như vậy là đủ để đọc định nghĩa node, mở các mẫu chính thức và gửi prompt tới API. Chúng mình không tạo video, nên bài này không có số liệu về tốc độ hay chất lượng. Với phần đó, xem hướng dẫn Wan 2.2 chính thức của ComfyUI.

Nên dùng workflow Wan 2.2 nào: 5B hay 14B?

Hướng dẫn chính thức của ComfyUI nói: “The Wan2.2 5B version should fit well on 8GB vram with the ComfyUI native offloading.” (Bản Wan2.2 5B chạy tốt trên 8GB VRAM nhờ cơ chế offload gốc của ComfyUI.) Các model 14B là file lớn hơn nhiều, như danh sách Hugging Face bên dưới cho thấy. Hãy bắt đầu với 5B trừ khi bạn có GPU lớn.

5B TI2V14B T2V
Templatevideo_wan2_2_5B_ti2vvideo_wan2_2_14B_t2v
Diffusion model(s)1 file, 10.00 GB (fp16)2 files (high + low noise), 14.29 GB each (fp8)
VAEwan2.2_vae, 1.41 GBwan_2.1_vae, 0.25 GB
Default size1280×704, 121 frames, 24 fps640×640, 81 frames, 16 fps
Default samplingKSampler, 20 steps, CFG 5, uni_pc2× KSamplerAdvanced, 20 steps split 10/10, CFG 3.5, euler

Các mẫu Wan 2.2 khác trong cùng gói: video_wan2_2_14B_i2v, video_wan2_2_14B_flf2v (khung hình đầu và cuối), video_wan2_2_14B_s2v (âm thanh sang video), video_wan2_2_14B_fun_camera, video_wan2_2_14B_fun_control, video_wan2_2_14B_fun_inpaint, video_wan2_2_5B_fun_control và video_wan2_2_5B_fun_inpaint.

File model nào cần tải và đặt ở đâu?

Mọi file đều lấy từ kho Comfy-Org/Wan_2.2_ComfyUI_Repackaged. Text encoder và VAE 2.1 lấy từ kho Wan 2.1 repackaged. Các dung lượng này lấy từ API của Hugging Face:

  10.00  split_files/diffusion_models/wan2.2_ti2v_5B_fp16.safetensors
  14.29  split_files/diffusion_models/wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors
  14.29  split_files/diffusion_models/wan2.2_t2v_low_noise_14B_fp8_scaled.safetensors
  28.58  split_files/diffusion_models/wan2.2_t2v_high_noise_14B_fp16.safetensors
  28.58  split_files/diffusion_models/wan2.2_t2v_low_noise_14B_fp16.safetensors
  14.29  split_files/diffusion_models/wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors
  14.29  split_files/diffusion_models/wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors
  11.37  split_files/text_encoders/umt5_xxl_fp16.safetensors
   6.74  split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors
   1.41  split_files/vae/wan2.2_vae.safetensors
   0.25  split_files/vae/wan_2.1_vae.safetensors
   1.23  split_files/loras/wan2.2_t2v_lightx2v_4steps_lora_v1.1_high_noise.safetensors
   1.23  split_files/loras/wan2.2_t2v_lightx2v_4steps_lora_v1.1_low_noise.safetensors

(Dung lượng tính bằng GB. Đây là trích đoạn; kho còn có các model Animate, S2V, Fun và VACE.)

Mẫu 5B lưu sẵn link tải ngay trong file workflow. Thư mục và URL của từng model:

model: wan2.2_ti2v_5B_fp16.safetensors -> diffusion_models  https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/diffusion_models/wan2.2_ti2v_5B_fp16.safetensors
model: umt5_xxl_fp8_e4m3fn_scaled.safetensors -> text_encoders  https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors
model: wan2.2_vae.safetensors -> vae  https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan2.2_vae.safetensors

Tải chúng về từ bên trong thư mục ComfyUI của bạn:

cd ComfyUI
wget -P models/diffusion_models https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/diffusion_models/wan2.2_ti2v_5B_fp16.safetensors
wget -P models/text_encoders https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors
wget -P models/vae https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan2.2_vae.safetensors

Đừng nhầm hai VAE. Model 5B dùng wan2.2_vae.safetensors. Các model 14B dùng wan_2.1_vae.safetensors.

Cài ComfyUI và kiểm tra các node Wan như thế nào?

Đây là các lệnh chúng mình đã chạy. Trên máy có GPU NVIDIA, hãy cài bản CUDA của PyTorch từ pytorch.org thay cho bản CPU, và bỏ --cpu.

git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu   # CPU-only build, as in our test
pip install -r requirements.txt
python main.py --cpu --listen 0.0.0.0

Dùng /system_stats để kiểm tra phiên bản. Các mẫu nằm trong một gói pip riêng, nên gói comfyui-workflow-templates cũ nghĩa là các mẫu Wan 2.2 có thể bị thiếu:

$ curl -s localhost:8188/system_stats | python3 -m json.tool
        "comfyui_version": "0.38.0",
        "required_frontend_version": "1.53.10",
        "installed_templates_version": "0.11.74",
        "required_templates_version": "0.11.74",
        "pytorch_version": "2.14.1+cpu",

/object_info liệt kê mọi node của bản build này. Bản build của chúng mình có 970 node. Trong danh sách có hai loại node Wan lẫn vào nhau:

  Wan22ImageToVideoLatent - model/conditioning/wan
  WanImageToVideo - model/conditioning/wan
  WanFirstLastFrameToVideo - model/conditioning/wan
  WanCameraImageToVideo - model/conditioning/wan/camera
  WanSoundImageToVideo - model/conditioning/wan/sound
  WanVaceToVideo - model/conditioning/wan/vace
  ...
  Wan2TextToVideoApi - partner/video/Wan
  Wan2ImageToVideoApi - partner/video/Wan
  WanTextToVideoApi - partner/video/Wan

Các node dưới model/conditioning/wan chạy trên GPU của bạn với các file ở trên. Các node dưới partner/video/Wan là Partner Nodes: chúng gửi tác vụ tới một API được host qua tài khoản Comfy của bạn và không cần file model cục bộ. Nếu bạn không có GPU phù hợp, hãy dùng Partner Nodes hoặc một công cụ được host như Pika hay Luma.

Sơ đồ text/image-to-video của bản 5B trông ra sao?

Đây là mẫu 5B chính thức, từng node một (các “widgets_values” của mỗi node):

   37 UNETLoader                 ['wan2.2_ti2v_5B_fp16.safetensors', 'default']
   38 CLIPLoader                 ['umt5_xxl_fp8_e4m3fn_scaled.safetensors', 'wan', 'default']
   39 VAELoader                  ['wan2.2_vae.safetensors']
   48 ModelSamplingSD3           [8]
    6 CLIPTextEncode             ['Low contrast. In a retro 1970s-style subway station, a street musician plays ...']
    7 CLIPTextEncode             ['色调艳丽,过曝,静态,细节模糊不清,字幕,...']
   55 Wan22ImageToVideoLatent    [1280, 704, 121, 1]
   56 LoadImage                  ['example.png', 'image']
    3 KSampler                   [898471028164125, 'randomize', 20, 5, 'uni_pc', 'simple', 1]
    8 VAEDecode                  []
   57 CreateVideo                [24]
   58 SaveVideo                  ['video/ComfyUI', 'auto', 'auto']

Điều quan trọng:

  • CLIPLoader type must be wan. The same node also offers stable_diffusion, sd3, ltxv and others. The UMT5 text encoder works only with wan.
  • ModelSamplingSD3 shift = 8 for 5B. The 14B template uses 5.
  • Text vs image to video is the same graph. Wan22ImageToVideoLatent has an optional start_image input. Connect the LoadImage node for image-to-video, or leave it unconnected for text-to-video.
  • The negative prompt is in Chinese, as in the original Wan release. Keep it.

Giới hạn kích thước theo định nghĩa node:

Wan22ImageToVideoLatent inputs:
  [required] vae: VAE
  [required] width: INT {'default': 1280, 'min': 32, 'max': 16384, 'step': 32}
  [required] height: INT {'default': 704, 'min': 32, 'max': 16384, 'step': 32}
  [required] length: INT {'default': 49, 'min': 1, 'max': 16384, 'step': 4}
  [required] batch_size: INT {'default': 1, 'min': 1, 'max': 4096}
  [optional] start_image: IMAGE
  outputs: ['LATENT']

Chiều rộng và chiều cao thay đổi theo bước 32, còn độ dài theo bước 4. Số khung hình của các mẫu đều có dạng 4n+1: 121 khung hình ở 24 fps là khoảng 5 giây. Để làm clip ngắn hơn, hạ length xuống 97, 73, 49 và tiếp tục như vậy. Để làm nhỏ hơn, hạ chiều rộng và chiều cao, ví dụ 832×480 hoặc 640×352.

Workflow 14B hoạt động thế nào: hai model, một lượt khử nhiễu?

Các mẫu 14B giấu node của chúng bên trong một subgraph tên “Text to Video(Wan2.2)”. Mở nó ra để thấy cách tách noise cao/noise thấp:

subgraph: Text to Video(Wan2.2) 30 nodes
   71 CLIPLoader                                        ['umt5_xxl_fp8_e4m3fn_scaled.safetensors', 'wan', 'default']
   73 VAELoader                                         ['wan_2.1_vae.safetensors']
   74 EmptyHunyuanLatentVideo                           [640, 640, 81, 1]
   75 UNETLoader                                        ['wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors', 'default']
   76 UNETLoader                                        ['wan2.2_t2v_low_noise_14B_fp8_scaled.safetensors', 'default']
   78 KSamplerAdvanced                                  ['disable', 0, 'fixed', 4, 1, 'euler', 'simple', 2, 4, 'disable']
   81 KSamplerAdvanced                                  ['enable', 923510416338945, 'randomize', 4, 1, 'euler', 'simple', 0, 2, 'enable']
   82 ModelSamplingSD3                                  [5.000000000000001]
   83 LoraLoaderModelOnly                               ['wan2.2_t2v_lightx2v_4steps_lora_v1.1_high_noise.safetensors', 1.0000000000000002]
   85 LoraLoaderModelOnly                               ['wan2.2_t2v_lightx2v_4steps_lora_v1.1_low_noise.safetensors', 1.0000000000000002]
  114 PrimitiveInt           Int (Steps)                [20, 'fixed']
  115 PrimitiveInt           Int (Split Steps)          [10, 'fixed']
  116 PrimitiveFloat         Float(CFG)                 [3.5]
  117 PrimitiveInt           Int (Steps)                [4, 'fixed']
  118 PrimitiveInt           Int (Split Steps)          [2, 'fixed']
  119 PrimitiveFloat         Float(CFG)                 [1]
  125 PrimitiveFloat         Float (FPS)                [16]
  126 PrimitiveFloat         Float (Duration)           [5]
  127 ComfyMathExpression                               ['floor(a * b) + 1']
  129 PrimitiveBoolean       Enable Lightning LoRA      [False]

Cách nó hoạt động:

  1. Sampler 81 (high-noise model) runs from step 0 to the split step with add_noise: enable and return_with_leftover_noise: enable. It hands a half-finished latent to the next sampler.
  2. Sampler 78 (low-noise model) continues from the split step to the last step with add_noise: disable.
  3. “Enable Lightning LoRA” switch. Off (default): 20 steps, split at 10, CFG 3.5, no LoRA. On: the two lightx2v LoRAs are applied, with 4 steps, split at 2, CFG 1. The widget values shown on nodes 78/81 are overwritten by these switches.
  4. Frame count is computed: floor(duration × fps) + 1 = floor(5 × 16) + 1 = 81 frames.

Subgraph đưa các đầu vào sau ra bên ngoài, nên bạn đổi model và cài đặt được mà không cần mở nó: text, width, height, duration, high_noise_model, high_noise_lightning_lora, low_noise_model, low_noise_lightning_lora, clip_name, vae_name, enable_turbo_mode.

Nếu bạn tự dựng sơ đồ, hãy giữ số bước và điểm tách giống nhau ở cả hai sampler. Mỗi sampler chỉ phủ một nửa số bước, nên nếu lệch nhau thì video sẽ còn nhiễu.

Chạy Wan 2.2 qua ComfyUI API như thế nào?

Endpoint /prompt nhận sơ đồ ở định dạng API, không phải file mẫu. Hãy xuất nó từ menu ComfyUI dưới dạng API workflow, hoặc viết tay. Đây là sơ đồ text-to-video 5B ở định dạng API:

{"prompt": {
 "37": {"class_type": "UNETLoader", "inputs": {"unet_name": "wan2.2_ti2v_5B_fp16.safetensors", "weight_dtype": "default"}},
 "38": {"class_type": "CLIPLoader", "inputs": {"clip_name": "umt5_xxl_fp8_e4m3fn_scaled.safetensors", "type": "wan", "device": "default"}},
 "39": {"class_type": "VAELoader", "inputs": {"vae_name": "wan2.2_vae.safetensors"}},
 "48": {"class_type": "ModelSamplingSD3", "inputs": {"model": ["37", 0], "shift": 8}},
 "6":  {"class_type": "CLIPTextEncode", "inputs": {"clip": ["38", 0], "text": "a red fox walking through snow, slow camera pan"}},
 "7":  {"class_type": "CLIPTextEncode", "inputs": {"clip": ["38", 0], "text": "blurry, low quality"}},
 "55": {"class_type": "Wan22ImageToVideoLatent", "inputs": {"vae": ["39", 0], "width": 1280, "height": 704, "length": 121, "batch_size": 1}},
 "3":  {"class_type": "KSampler", "inputs": {"model": ["48", 0], "positive": ["6", 0], "negative": ["7", 0], "latent_image": ["55", 0],
        "seed": 1, "steps": 20, "cfg": 5, "sampler_name": "uni_pc", "scheduler": "simple", "denoise": 1}},
 "8":  {"class_type": "VAEDecode", "inputs": {"samples": ["3", 0], "vae": ["39", 0]}},
 "57": {"class_type": "CreateVideo", "inputs": {"images": ["8", 0], "fps": 24}},
 "58": {"class_type": "SaveVideo", "inputs": {"video": ["57", 0], "filename_prefix": "video/wan22_5b", "format": "auto", "codec": "auto"}}
}}
curl -s -X POST localhost:8188/prompt -H 'Content-Type: application/json' -d @5b_api.json | python3 -m json.tool

Xử lý sự cố: lỗi “Value not in list” ở các node loader

Đây là lỗi phổ biến nhất với một workflow Wan 2.2 mới. Chúng mình gửi sơ đồ ở trên tới một máy chủ không có file model. Máy chủ từ chối nó trước khi chạy bất cứ thứ gì:

{
    "error": {
        "type": "prompt_outputs_failed_validation",
        "message": "Prompt outputs failed validation",
        ...
    },
    "node_errors": {
        "39": {
            "errors": [{"type": "value_not_in_list", "message": "Value not in list",
                        "details": "vae_name: 'wan2.2_vae.safetensors' not in ['pixel_space']"}],
            "class_type": "VAELoader"
        },
        "38": {
            "errors": [{"type": "value_not_in_list", "message": "Value not in list",
                        "details": "clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors' not in []"}],
            "class_type": "CLIPLoader"
        },
        "37": {
            "errors": [{"type": "value_not_in_list", "message": "Value not in list",
                        "details": "unet_name: 'wan2.2_ti2v_5B_fp16.safetensors' not in []"}],
            "class_type": "UNETLoader"
        }
    }
}

Log của máy chủ cũng cho thấy điều tương tự:

[ERROR] Failed to validate prompt for output 58:
[ERROR] * VAELoader 39:
[ERROR]   - Value not in list: vae_name: 'wan2.2_vae.safetensors' not in ['pixel_space']
[ERROR] * CLIPLoader 38:
[ERROR]   - Value not in list: clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors' not in []
[ERROR] * UNETLoader 37:
[ERROR]   - Value not in list: unet_name: 'wan2.2_ti2v_5B_fp16.safetensors' not in []
[ERROR] Output will be ignored
[WARNING] invalid prompt: {'type': 'prompt_outputs_failed_validation', ...}

Cách đọc: danh sách sau chữ not in là các file ComfyUI tìm thấy trong thư mục đó. [] nghĩa là thư mục rỗng. ['pixel_space'] là một tùy chọn có sẵn của VAELoader, không phải file. Cách sửa:

  • Check the folder: the diffusion model goes in models/diffusion_models (not checkpoints), and the UMT5 encoder goes in models/text_encoders.
  • Check the exact file name. A browser may add (1) to a second download, and then the name no longer matches.
  • Restart ComfyUI or refresh the page after adding files, so the lists are rebuilt.
  • Check the VAE: the 5B model needs wan2.2_vae and the 14B models need wan_2.1_vae.

Các thư mục model mà một bản ComfyUI hiện tại tạo ra:

/ComfyUI/models/checkpoints/
/ComfyUI/models/clip/
/ComfyUI/models/clip_vision/
/ComfyUI/models/diffusion_models/
/ComfyUI/models/loras/
/ComfyUI/models/text_encoders/
/ComfyUI/models/unet/
/ComfyUI/models/vae/
...

Chạy Wan 2.2 trên GPU nhỏ được không?

Các cài đặt bạn có thể đổi, đều thấy được trong các mẫu và định nghĩa node ở trên:

  • Use 5B: per the ComfyUI guide, it fits on 8 GB of VRAM with ComfyUI’s built-in offloading.
  • Use fp8 files for 14B: 14.29 GB per model instead of 28.58 GB for fp16. The text encoder also has an fp8 version (6.74 GB instead of 11.37 GB).
  • Lower width, height and length: fewer pixels and frames mean less memory.
  • Turn on the Lightning LoRA in the 14B template: 4 sampling steps instead of 20.
  • weight_dtype on UNETLoader accepts default, fp8_e4m3fn, fp8_e4m3fn_fast and fp8_e5m2. Use it to load an fp16 file in fp8.

Nếu bạn chỉ muốn ảnh tĩnh từ một model chạy cục bộ, một công cụ cục bộ đơn giản hơn như Fooocus cần thiết lập ít hơn nhiều.

Câu hỏi thường gặp về workflow Wan 2.2 ComfyUI

Wan 2.2 có chạy được trên CPU không?

ComfyUI khởi động được với --cpu và nạp các node Wan, như trong thử nghiệm của chúng mình. Việc thực sự tạo video theo cách đó thì chưa được thử ở đây. Với model trên 10 GB và hơn 100 khung hình, hãy tính đến việc dùng GPU NVIDIA.

Vì sao workflow 14B có hai model?

Wan 2.2 14B chia việc khử nhiễu thành hai giai đoạn. Model noise cao làm các bước đầu (bố cục và chuyển động), còn model noise thấp hoàn thiện chi tiết. Trong ComfyUI, đây là hai node KSamplerAdvanced dùng chung số bước và chia nó ra.

Tìm mẫu ở đâu?

Cập nhật ComfyUI và gói comfyui-workflow-templates của nó, rồi mở trình duyệt mẫu và tìm Wan 2.2. Tên file là video_wan2_2_5B_ti2v, video_wan2_2_14B_t2v, video_wan2_2_14B_i2v và video_wan2_2_14B_flf2v.

Trạm Công Nghệ AI
Logo
Compare items
  • Total (0)
Compare
0