Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/test_accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ def noop(*args, **kwargs):
pass

with (
patch(f"torch.{torch_device}.set_device", noop),
# Some backends such as MPS do not expose a module-level `set_device`.
# This test only exercises env var parsing, so a synthetic attribute is enough.
patch(f"torch.{torch_device}.set_device", noop, create=True),
patch_environment(ACCELERATE_TORCH_DEVICE=f"{torch_device}:64"),
):
accelerator = Accelerator()
Expand Down