Skip to content

Apple MPS support#225

Open
drscotthawley wants to merge 2 commits intoStability-AI:mainfrom
drscotthawley:Apple-MPS-support
Open

Apple MPS support#225
drscotthawley wants to merge 2 commits intoStability-AI:mainfrom
drscotthawley:Apple-MPS-support

Conversation

@drscotthawley
Copy link

device can also equal "mps" if it's available. makes things run way faster than CPU on Mac.

@ymgenesis
Copy link

The audio output I get from this is really clipped and doesn't sound correct. Was this working for you?

@drscotthawley
Copy link
Author

@ymgenesis 🤷 I just assumed that's what the model sounds like, e.g. if you integrate too long or your prompt isn't suited to the small model. I didn't change anything but the device it executes on.

If I try to run it on CPU, it seems to just hang, so MPS was the only way I could run inference at the time. I'll try to compare against a CUDA run.

@drscotthawley
Copy link
Author

drscotthawley commented Nov 21, 2025

Whoa, CUDA results sound MUCH better than analogous MPS calculations! 😱

I see that there are many accuracy-related related MPS issues for PyTorch, https://github.com/pytorch/pytorch/issues?q=is%3Aissue%20state%3Aopen%20mps, i.e. not just about unsupported ops.

Not sure yet if this is just for half precision or full precision too.

This is surely "upstream" from stable-audio-tools. My students and I will try to look into this. Will also monitor issue #181; please share any updates/fixes.

@Cortexelus
Copy link
Contributor

Cortexelus commented Nov 24, 2025 via email

@drscotthawley
Copy link
Author

drscotthawley commented Dec 1, 2025

@Cortexelus We observe this on M1 & M2 chips. Execution is fast but prone to garbage outputs compared to CUDA. This is not about CPU fallback or newer M4 Chips.

@Taikakim
Copy link

Hmm I think there was an issue with the code with the Torch audio saving function lately where it's expecting a value between 0 and 1 for the volume, but instead getting a FP16 value, so sound will be tens of thousands of times louder than it should, essentially producing just a clipped square wave. I patched it with Claude Code, but I'm not on my computer now so I can't check exactly what it was.

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.

4 participants