Skip to content

Report MPS as the accelerator in accelerate env - #4158

Open
xquantize wants to merge 1 commit into
huggingface:mainfrom
xquantize:env-report-mps-accelerator
Open

Report MPS as the accelerator in accelerate env#4158
xquantize wants to merge 1 commit into
huggingface:mainfrom
xquantize:env-report-mps-accelerator

Conversation

@xquantize

Copy link
Copy Markdown

What does this PR do?

accelerate env reports PyTorch accelerator: N/A on Apple Silicon. The accelerator-detection chain in env_command checks CUDA, XPU, MLU, SDAA, MUSA, NPU and NEURON, but not MPS, so on a Mac with a working MPS backend it falls through to "N/A", and the diagnostic that your issue template asks users to paste under-reports their hardware.

This adds an MPS branch (using the existing is_mps_available helper) to both the accelerator-name chain and the device-type chain, so it now reports:

Before (M3 Pro, macOS, torch 2.13):

  • PyTorch accelerator: N/A

After:

  • PyTorch accelerator: MPS
  • MPS type: Apple M3 Pro

The MPS type value is read at runtime via sysctl machdep.cpu.brand_string (macOS-only, which is fine since MPS is Apple-only), with a platform.processor() fallback if that call fails. Verified manually on Apple Silicon. Happy to gate the sysctl call on platform.system() == "Darwin" or change the MPS type source if you'd prefer.

Fixes # (issue)

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?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@SunMarc — this touches the CLI (accelerate env).

…ction chain in

Copy-and-paste the text below in your GitHub issue

- `Accelerate` version: 1.15.0.dev0
- Platform: macOS-26.5.2-arm64-arm-64bit
- `accelerate` bash location: /Users/zaneneave/Documents/Research/accelerate/.venv/bin/accelerate
- Python version: 3.12.13
- Numpy version: 2.5.2
- PyTorch version: 2.13.0
- PyTorch accelerator: MPS
- System RAM: 18.00 GB
- MPS type: Apple M3 Pro
- `Accelerate` default config:
	Not found checked CUDA, XPU, MLU, SDAA, MUSA, NPU and NEURON but not MPS, so on Apple Silicon it reported 'PyTorch accelerator: N/A' despite MPS being available. Add an MPS branch (via is_mps_available) plus a corresponding 'MPS type' line reporting the chip name.
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