has anyone tried it on M1 Mac?

#29
by CharlieHan - opened
from diffusers import AutoPipelineForText2Image
import torch
        
pipeline = AutoPipelineForText2Image.from_pretrained('dataautogpt3/OpenDalleV1.1', torch_dtype=torch.float16).to('mps')        
image = pipeline('black fluffy gorgeous dangerous cat animal creature, large orange eyes, big fluffy ears, piercing gaze, full moon, dark ambiance, best quality, extremely detailed').images[0]

changed cuda to mps, and get the error below

Traceback (most recent call last):
  File "/private/tmp/opendallev1.1/launch_opendallev1.1.py", line 8, in <module>
    image = pipeline(t).images[0]
            ^^^^^^^^^^^
  File "/private/tmp/opendallev1.1/venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/opendallev1.1/venv/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 1113, in __call__
    timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/opendallev1.1/venv/lib/python3.11/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py", line 144, in retrieve_timesteps
    scheduler.set_timesteps(num_inference_steps, device=device, **kwargs)
  File "/private/tmp/opendallev1.1/venv/lib/python3.11/site-packages/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py", line 280, in set_timesteps
    timesteps = torch.from_numpy(timesteps).to(device)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
Package            Version
------------------ ----------
accelerate         0.25.0
diffusers          0.25.0
torch              2.1.2
transformers       4.36.2

KDPM2AncestralDiscreteScheduler is broken on MPS (Mac's) so you'll need to try another scheduler.

Having said that, it appears to have been fixed in Diffusers 0.26.1 and your original code now works.

Sign up or log in to comment