Uses MPS (Mac acceleration) by default when available by dwarkeshsp · Pull Reque...
source link: https://github.com/openai/whisper/pull/382
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Uses MPS (Mac acceleration) by default when available #382
Conversation
Currently, Whisper defaults to using the CPU on MacOS devices despite the fact that PyTorch has introduced Metal Performance Shaders framework for Apple devices in the nightly release (more info).
With my changes to init.py, torch checks in MPS is available if torch.device has not been specified. If it is, and CUDA is not available, then Whisper defaults to MPS.
This way, Mac users can experience speedups from their GPU by default.
@dwarkeshsp have you measured any speedups compared to using the CPU? |
Doesn't this also require switching FP16 off? |
DiegoGiovany commented Nov 9, 2022 •
I'm getting this error when try to use MPS /Users/diego/.pyenv/versions/3.10.6/lib/python3.10/site-packages/whisper-1.0-py3.10.egg/whisper/decoding.py:629: UserWarning: The operator 'aten::repeat_interleave.self_int' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/diego/Projects/pytorch/aten/src/ATen/mps/MPSFallback.mm:11.) any clues? |
@DiegoGiovany Not an expert on this but It looks like PyTorch itself is missing some operators for MPS. See for example |
gltanaka commented Nov 17, 2022 •
Thanks for your work. I just tried this. Unfortunately, it didn't work for me on my m1 max with 32GB. No errors on install and it works fine when run without mps: whisper audiofile_name --model medium When I run: whisper audiofile_name --model medium --device mps Here is the error I get: When I run: whisper audiofile_name --model medium --device mps --fp16 False Here is the error I get: Basically, same error as @DiegoGiovany. Any ideas on how to fix? |
megeek commented Nov 28, 2022
+1 for me! I'm actually using an Intel Mac with Radeon Pro 560X 4 GB... |
PhDLuffy commented Dec 8, 2022 •
not work,with mbp2015 pytorch 1.3 stable,egpu RX580, MacOS 12.3. changed the code as the same as yours. changed to use --device mps but show error, maybe there is still somewhere to change or modify. use --device cpu, it works. with other pytorch-metal project, MPS works. |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No reviews
No one assigned
None yet
No milestone
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK