Body:
Describe the bug
When importing diffusers on a non-CUDA system (e.g., Apple Silicon Mac with MPS), a warning is
emitted:
/torch/amp/autocast_mode.py:270: UserWarning: User provided device_type of 'cuda', but CUDA is not
available. Disabling
warnings.warn(
This occurs because Kandinsky5TimeEmbeddings class has a hardcoded "cuda" device type in the
@torch.autocast decorator.
Location
File: diffusers/models/transformers/transformer_kandinsky.py
Line: 168
@torch.autocast(device_type="cuda", dtype=torch.float32)defforward(self, timestep):
RootCauseThedecoratorisevaluatedatimporttime, notatruntime. OnsystemswithoutCUDA (likeAppleSiliconMacsusingMPS), thistriggersthewarningeventhoughtheKandinskymodelmayneverbeused.
Reproduction# On a Mac with Apple Silicon (no CUDA)fromdiffusersimportZImagePipeline# or any pipeline# Warning appears immediately on importExpectedbehaviorNowarningshouldappearwhenimportingdiffusersonnon-CUDAsystems.
Environment-OS: macOS (AppleSiliconM-series)
-Python: 3.13-PyTorch: 2.x (MPSbackend)
-Diffusers: latest
Body:
Describe the bug
When importing
diffuserson a non-CUDA system (e.g., Apple Silicon Mac with MPS), a warning isemitted:
/torch/amp/autocast_mode.py:270: UserWarning: User provided device_type of 'cuda', but CUDA is not
available. Disabling
warnings.warn(
This occurs because
Kandinsky5TimeEmbeddingsclass has a hardcoded"cuda"device type in the@torch.autocastdecorator.Location
File:
diffusers/models/transformers/transformer_kandinsky.pyLine: 168