-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added MPS support #550
Added MPS support #550
Conversation
Thanks @Jerry-Master ! Works on the baseline MacBook M1 Pro as well. macOS Sonoma 14 Beta 4 |
@Jerry-Master have you checked if this doesn't break linux and windows ? |
@Jerry-Master if you confirm this I'll merge it. |
I can only confirm that I have tested it on Rocky Linux 8.8 with NVIDIA GPU 3090. I wrote everything to be backward compatible, so I have no reasons to assume it could break on Windows or Debian Linux, but have no device to check it at the moment. |
Note that it needs pytorch nightly/2.1 to work: |
Yes, I said that in the description of the pull request, but the nightly is only necessary for the MPS backend version, for CUDA it works as before. That nightly requirement will take probably months to delete since MPS is slowly developing. |
@Jerry-Master are you looking into the |
I haven't tried |
Can you update in readme section about nightly version installation for MPS in same pl? |
Thanks! I receive this error:
Haven't looked into it yet, but can begin in ~15 min |
@mattorp can you provide a full traceback so that I can see the line that is causing the error? That line points to a torch file, but the error must be caused elsewhere in the repository. |
|
Seems an issue with deepspeed, for some reason in |
I tried that with no luck 🤔 I'll keep poking around and get back to you
|
Oh, changing the default, not the flag helped. Verifying if it completes now |
You can do export CUDA_HOME="path_to_your_cuda" and then run it with deepspeed , i don't know if there is MPS support in deepspeed, if not you can skip that if mps is active and check. |
I don't believe cuda is available on the M chips, right? It keeps hanging at 0% even for short texts:
While this works:
I have to reset my environment for |
I think deepspeed doesn't support Mac so it is always looking for cuda_home and it's not there for you. |
Can't know how to fix it without trying. Also, I didn't use |
Removing python read.py \
--half True \
--voice random \
--preset ultra_fast \
--output_path "debug" \
--textfile 'debug/test.md' With
|
I'll give it a look when I have time, but doesn't make any sense. |
Thanks for the speedy responses to this! |
@Jerry-Master let's skip deepspeed while doing inference and handle that in autoregressive.py , once this changes are done , I'll merge this. |
I have removed the option for deepspeed after argument parsing. Under the mps version that flag is ignored. It will be awesome if @mattorp could test it. |
should i merge this now ? |
Works for me! Another note: For the lower specced (16 GB ram) the user might need to split the text into smaller chunks to get it working. |
Is mps still supported on tortoise v2? |
I managed to make the code work for
do_tts.py
and theis_this_from_tortoise.py
on Apple Silicon. It takes the following times to generate a single phrase on various presets:I run the testing on my mac M1 Max with macOS 13.5. You need to have macOS 13.3+ to have int64 support on MPS. And you also need to use the nightly version of pytorch. Not all the operations are run in the GPU, I modified the code to fall back to CPU in some cases that gave errors. I also recommend running the code with
PYTORCH_ENABLE_MPS_FALLBACK=1
. In the future many more operations like theaten::_fft_r2c
will have support in pytorch with MPS backend and so we can hope the inference times to get better, but for now, it is what it is.Sidenote
The classifier that detects whether a clip is generated or not can be easily fooled by re-recording the audio.