Describe the bug
In src/diffusers/utils/torch_utils.py, randn_tensor suppresses the CPU-generator info log on MPS with:
if device != "mps":
logger.info(...)
device is a torch.device object, so the comparison to the string "mps" is always True - the log fires even on MPS targets where it's meant to be suppressed. This has been silently broken since the check was introduced in #1902.
Reproduction
import torch
from diffusers.utils import torch_utils
gen = torch.Generator(device="cpu")
torch_utils.randn_tensor((1, 2), generator=gen, device=torch.device("mps"), dtype=torch.float32)
# -> info log "The passed generator was created on 'cpu'..." still prints
Expected behavior
Compare device.type != "mps" instead. Fix + regression test in PR #14501 (rebase of approved-but-unmerged #13508).
Describe the bug
In
src/diffusers/utils/torch_utils.py,randn_tensorsuppresses the CPU-generator info log on MPS with:deviceis atorch.deviceobject, so the comparison to the string"mps"is alwaysTrue- the log fires even on MPS targets where it's meant to be suppressed. This has been silently broken since the check was introduced in #1902.Reproduction
Expected behavior
Compare
device.type != "mps"instead. Fix + regression test in PR #14501 (rebase of approved-but-unmerged #13508).