Skip to content

tests: Gracefully handle missing set_device for mps#4028

Open
booxter wants to merge 1 commit into
huggingface:mainfrom
booxter:tests-mps-set-device
Open

tests: Gracefully handle missing set_device for mps#4028
booxter wants to merge 1 commit into
huggingface:mainfrom
booxter:tests-mps-set-device

Conversation

@booxter
Copy link
Copy Markdown
Contributor

@booxter booxter commented May 4, 2026

What does this PR do?

mps backend doesn't have set_device, so if mps is available on test run,
the test fails with:

AttributeError: <module 'torch.mps' from
'[...]/site-packages/torch/mps/__init__.py'> does not have the attribute
'set_device'

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

mps backend doesn't have set_device, so if mps is available on test run,
the test fails with:

AttributeError: <module 'torch.mps' from
'[...]/site-packages/torch/mps/__init__.py'> does not have the attribute
'set_device'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant