WanAnimatePipeline.get_i2v_mask() defaults device to "cuda", which raises on non-CUDA accelerators (NPU/XPU/MPS)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- machine-learning
Línea de trabajo
Empieza en src/diffusers/pipelines/wan/pipeline_wan_animate.py, en WanAnimatePipeline.get_i2v_mask(), y compara después su gestión del dispositivo con prepare_reference_image_latents y encode_image. Verifica que las llamadas sin un dispositivo explícito utilicen el dispositivo de ejecución del pipeline y que una invocación que no sea CUDA ya no intente realizar una asignación de CUDA; considera por separado la función auxiliar con el mismo nombre en src/diffusers/modular_pipelines/wan_animate_2/encoders.py.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- Python
- Estrellas
- 34.6k
- Forks
- 7.4k
- Merge medio
- 4 d 8 h
- PR fusionados (30 d)
- 50
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de huggingface/diffusers
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
huggingface/diffusers#14888 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
huggingface/diffusers#14864 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
huggingface/diffusers#14837 ·
Los mantenedores suelen responder en 1 día
-
bug needs-env-info pipelines
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
huggingface/diffusers#14794 ·
Los mantenedores suelen responder en 1 día
-
bug needs-code-example needs-env-info pipelines
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
huggingface/diffusers#14780 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de huggingface/diffusers
Issues similares
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
workflow: a tick's dispatch counts as 'only this step', and no review self-grants a round unattendedAbiertoworkflow
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
kristofdegrave/homeassistant-smart-charging#1505 ·
Los mantenedores suelen responder en 1 día
-
New Submission: TropWATERAbiertometadata submission
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Wrongly named dashboard variableAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
canonical/content-cache-operator#163 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[submission]Abiertosubmission
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
leanprover/lean-eval-submissions#1852 ·
Los mantenedores suelen responder en 1 día