Skip to content
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

Add support for --device mps option for MacOS #118

Open
ozio opened this issue Dec 17, 2024 · 3 comments
Open

Add support for --device mps option for MacOS #118

ozio opened this issue Dec 17, 2024 · 3 comments

Comments

@ozio
Copy link

ozio commented Dec 17, 2024

Currently, the --device flag only supports two options: cpu and cuda. However, cuda is not available on MacOS, leaving cpu as the only option, which is significantly slower.

MacOS users can leverage the Metal Performance Shaders (MPS) backend for GPU acceleration, which greatly speeds up processing.

Please add support for --device mps to enable GPU acceleration on MacOS.

As a temporary solution, I am manually hardcoding the value in the environment folder, but this is a dirty hack and not maintainable.

Adding mps support natively would improve usability and performance for MacOS users.

@jeeftor
Copy link

jeeftor commented Dec 20, 2024

Can you share your hack? I'd like to try it out.

@ozio
Copy link
Author

ozio commented Dec 21, 2024

device = torch.device(self.device)

Here I changed self.device to "mps".

@unclefomotw
Copy link

I guess this is because https://github.com/OpenNMT/CTranslate2 does not support mps?

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

No branches or pull requests

3 participants