Skip to content

fix(wan): use device-agnostic default for get_i2v_mask - #14765

Open
li-lizhe wants to merge 1 commit into
huggingface:mainfrom
li-lizhe:fix/wan-animate-device-default
Open

li-lizhe wants to merge 1 commit into
huggingface:mainfrom
li-lizhe:fix/wan-animate-device-default

Conversation

@li-lizhe

Copy link
Copy Markdown

Description: Fix the get_i2v_mask method's device="cuda" default parameter which causes a crash on non-CUDA accelerators (Ascend NPU, Intel XPU, Apple MPS, etc.) when called without an explicit device argument.

Change:

  • Default device from "cuda" to None
  • Add device = device or self._execution_device at the function top
  • Follows the established pattern used in prepare_reference_image_latents, encode_image, and other pipeline methods

Verification on Ascend 910B NPU (torch 2.14.0a0 + torch_npu):

  • Old code: torch.zeros(1, device="cuda") crashes with AssertionError: Torch not compiled with CUDA enabled
  • Fix: device = device or self._execution_device resolves to npu:0, tensor created successfully on NPU

The `get_i2v_mask` method had a hardcoded `device="cuda"` default,
which crashes on non-CUDA accelerators (Ascend NPU, etc.) with
"Torch not compiled with CUDA enabled" when called without an
explicit device argument.

Change the default to None and resolve via `self._execution_device`,
matching the pattern used across other pipeline methods.

Verified on Ascend 910B NPU: torch.zeros(device="cuda") crashes,
fix with device-agnostic resolution creates tensors on the correct
device.
@github-actions github-actions Bot added pipelines size/S PR with diff < 50 LOC labels Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @li-lizhe, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice.

Once the PR links an issue (or gets the no-issue-needed label), you can ignore this message — it stays here as a comment, but it no longer applies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipelines size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant