Describe the bug
In src/diffusers/modular_pipelines/modular_pipeline.py, two guards in Pipeline.to() are written as device_type in ["cuda", "xpu"]:
- line ~2691 — the sequential offload conflict check (raises the "you activated sequential model offloading … but are now attempting to move the pipeline to device" error)
- line ~2704 — the model offload warning (the operation succeeds but the offload benefit is silently lost)
Ascend NPU is also an accelerator where explicit device placement conflicts with offloading, but device_type == "npu" matches neither guard, so NPU users get silently broken offload behavior instead of the same clear error/warning CUDA and XPU users get.
device_type |
Current guard |
Expected |
"cuda" |
fires |
fires |
"xpu" |
fires |
fires |
"npu" |
silently skipped |
should fire |
"cpu" |
skipped |
skipped |
Reproduction
import torch, torch_npu # Ascend 910B
pipe = SomePipeline.from_pretrained(...)
pipe.enable_sequential_cpu_offload()
pipe.to("npu") # no error raised, although the pipeline is sequentially offloaded
Environment
- diffusers
main
- Ascend 910B NPU, torch 2.14 + torch_npu
device_type resolves to "npu" for torch.device("npu")
Fix
Extend both guard lists to ["cuda", "xpu", "npu"]. PR: #14786
Describe the bug
In
src/diffusers/modular_pipelines/modular_pipeline.py, two guards inPipeline.to()are written asdevice_type in ["cuda", "xpu"]:Ascend NPU is also an accelerator where explicit device placement conflicts with offloading, but
device_type == "npu"matches neither guard, so NPU users get silently broken offload behavior instead of the same clear error/warning CUDA and XPU users get.device_type"cuda""xpu""npu""cpu"Reproduction
Environment
maindevice_typeresolves to"npu"fortorch.device("npu")Fix
Extend both guard lists to
["cuda", "xpu", "npu"]. PR: #14786