Skip to content

MPS device not properly tested in EulerAncestralDiscreteScheduler #1183

Description

@florian-ivadolabs

Describe the bug

When the device set to mps, str(device) can return "mps:0".
The proper way to test the device would be device.type == "mps".
The wrong test is used in EulerAncestralDiscreteScheduler preventing to run the right code:

device = model_output.device if torch.is_tensor(model_output) else "cpu"
if str(device) == "mps":
# randn does not work reproducibly on mps
noise = torch.randn(model_output.shape, dtype=model_output.dtype, device="cpu", generator=generator).to(
device
)
else:
noise = torch.randn(model_output.shape, dtype=model_output.dtype, device=device, generator=generator).to(
device
)

if str(device) == "mps" should be replaced by if device.type == "mps":

Reproduction

Run twice an inference with the same seed and the EulerAncestral scheduler doest generate the same image

Logs

No log as no error

System Info

diffusers 0.7.2, Mac OS ventura, M1 Max env with Python 3.9.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions