From e99cdcf3b8fdccd8c5b9697cef041a9b92569261 Mon Sep 17 00:00:00 2001 From: lzws <63908509+lzws@users.noreply.github.com> Date: Mon, 12 Jan 2026 22:08:48 +0800 Subject: [PATCH 1/2] wan usp bug fix --- diffsynth/pipelines/wan_video.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/diffsynth/pipelines/wan_video.py b/diffsynth/pipelines/wan_video.py index ca59d2a0..45ea43c0 100644 --- a/diffsynth/pipelines/wan_video.py +++ b/diffsynth/pipelines/wan_video.py @@ -122,11 +122,15 @@ def from_pretrained( model_config.model_id = redirect_dict[model_config.origin_file_pattern][0] model_config.origin_file_pattern = redirect_dict[model_config.origin_file_pattern][1] - # Initialize pipeline - pipe = WanVideoPipeline(device=device, torch_dtype=torch_dtype) if use_usp: from ..utils.xfuser import initialize_usp initialize_usp(device) + import torch.distributed as dist + from ..core.device.npu_compatible_device import get_device_name, IS_NPU_AVAILABLE, IS_CUDA_AVAILABLE + if dist.is_available() and dist.is_initialized() and (IS_CUDA_AVAILABLE or IS_NPU_AVAILABLE): + device = get_device_name() + # Initialize pipeline + pipe = WanVideoPipeline(device=device, torch_dtype=torch_dtype) model_pool = pipe.download_and_load_models(model_configs, vram_limit) # Fetch models From fd87b727541ffaff186ab3ad326f1787af9350c2 Mon Sep 17 00:00:00 2001 From: lzws <63908509+lzws@users.noreply.github.com> Date: Wed, 14 Jan 2026 16:33:02 +0800 Subject: [PATCH 2/2] wan usp bug fix --- diffsynth/pipelines/wan_video.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diffsynth/pipelines/wan_video.py b/diffsynth/pipelines/wan_video.py index 45ea43c0..5b4c0b41 100644 --- a/diffsynth/pipelines/wan_video.py +++ b/diffsynth/pipelines/wan_video.py @@ -126,8 +126,8 @@ def from_pretrained( from ..utils.xfuser import initialize_usp initialize_usp(device) import torch.distributed as dist - from ..core.device.npu_compatible_device import get_device_name, IS_NPU_AVAILABLE, IS_CUDA_AVAILABLE - if dist.is_available() and dist.is_initialized() and (IS_CUDA_AVAILABLE or IS_NPU_AVAILABLE): + from ..core.device.npu_compatible_device import get_device_name + if dist.is_available() and dist.is_initialized(): device = get_device_name() # Initialize pipeline pipe = WanVideoPipeline(device=device, torch_dtype=torch_dtype)