WanAnimatePipeline.get_i2v_mask() defaults device to "cuda", which raises on non-CUDA accelerators (NPU/XPU/MPS)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
src/diffusers/pipelines/wan/pipeline_wan_animate.py の WanAnimatePipeline.get_i2v_mask() から始め、デバイスの扱いを prepare_reference_image_latents および encode_image と比較してください。明示的なデバイスを指定しない呼び出しではパイプラインの実行デバイスが使用され、CUDA 以外での呼び出しでは CUDA の割り当てを試みなくなっていることを確認してください。src/diffusers/modular_pipelines/wan_animate_2/encoders.py にある同名のヘルパーは別途検討してください。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
WanAnimatePipeline.get_i2v_mask() (src/diffusers/pipelines/wan/pipeline_wan_animate.py, line ~471) declares its device parameter with a hard-coded CUDA default:
def get_i2v_mask(
self,
batch_size: int,
latent_t: int,
latent_h: int,
latent_w: int,
mask_len: int = 1,
mask_pixel_values: torch.Tensor | None = None,
dtype: torch.dtype | None = None,
device: str | torch.device = "cuda", # <-- here
) -> torch.Tensor:
The mask is allocated with torch.zeros(..., device=device) / .to(device=device), so any call that does not pass device explicitly allocates on CUDA. On builds without CUDA (Ascend NPU via torch_npu, Intel XPU, Apple MPS) that raises immediately:
AssertionError: Torch not compiled with CUDA enabled
Every sibling helper on the same pipeline uses the device-agnostic convention instead (prepare_reference_image_latents, encode_image, ... carry device: torch.device | None = None and resolve it with device = device or self._execution_device), so the "cuda" default is inconsistent with the rest of the file and is a trap for any device-agnostic caller.
Reproduction
On a non-CUDA accelerator (verified on Ascend 910B2, torch 2.14.0a0/2.15.0.dev+cpu build with torch_npu):
import torch
torch.zeros(1, device="cuda")
# AssertionError: Torch not compiled with CUDA enabled
Calling the pipeline method without an explicit device hits the same path:
pipe.get_i2v_mask(batch_size=1, latent_t=1, latent_h=8, latent_w=8)
Expected behaviour
The default should resolve to the pipeline's execution device instead of assuming CUDA, matching the convention already used by the neighbouring helpers: device: str | torch.device | None = None plus device = device or self._execution_device at the top of the method.
Scope (for transparency)
The two in-tree call sites in the same file (prepare_reference_image_latents, prepare_prev_segment_cond_latents) both pass device explicitly, so nothing in the current in-tree path crashes today - this is a latent/API-hygiene defect for external callers and for future call sites. The module-level helper get_i2v_mask(lat_t, lat_h, lat_w, mask_len=1, device="cuda") in src/diffusers/modular_pipelines/wan_animate_2/encoders.py carries the same CUDA default; happy to cover it in the linked PR or in a follow-up, whichever the maintainers prefer.
System Info
- diffusers: main
- hardware: Ascend 910B2 NPU (torch 2.14.0a0 / 2.15.0.dev20260917+cpu +
torch_npu); the same failure applies to any CUDA-less build (XPU, MPS).
- 主要言語
- Python
- スター
- 34.6k
- フォーク
- 7.4k
- 平均マージ
- 3日 20時間
- マージ済み PR(30日)
- 55
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/diffusers のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
huggingface/diffusers#14888 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
huggingface/diffusers#14882 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
huggingface/diffusers#14864 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
huggingface/diffusers#14837 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-env-info pipelines
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
huggingface/diffusers#14794 ·
メンテナーはふだん 1 日以内に返信
huggingface/diffusers の issue をすべて見る
似ている issue
-
docs pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pydantic/pydantic-ai#8863 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
run-llama/llama_index#23278 ·
メンテナーはふだん 2 日以内に返信
-
documentation from-review-extraction github-actions priority: low severity:nit
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
LearningCircuit/local-deep-research#6946 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
oracle/langchain-oracle#323 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
tenstorrent/tt-metal#58057 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信