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

CUDA support #31

Closed
Macoron opened this issue Jun 14, 2023 · 6 comments · Fixed by #61
Closed

CUDA support #31

Macoron opened this issue Jun 14, 2023 · 6 comments · Fixed by #61
Labels
enhancement New feature or request

Comments

@Macoron
Copy link
Owner

Macoron commented Jun 14, 2023

Whisper.cpp now supports CUDA. While it's really annoying to setup CUDA and its drivers, it should give a nice performance boost for Windows and Linux PCs with Nvidia cards.

I want to make it optional. Probably best way to do that is to compile one .dll with CUDA support and one without. I would need to figure out how to switch between them in runtime.

Also it will probably be smart to add fallback to CPU when no CUDA available.

@Macoron Macoron added the enhancement New feature or request label Jun 14, 2023
@atx-barnes
Copy link

This would be awesome. Any updates on this enhancement? What would be the use case for switching during runtime.

@Macoron
Copy link
Owner Author

Macoron commented Aug 7, 2023

Any updates on this enhancement?

I don't have PC with CUDA supported GPU. But in theory, you would need to just recompile dlls with this flag and replace it in plugin folder.

What would be the use case for switching during runtime.

I want to make CUDA optional, because this is a very niche use case. Most people will use CPU inference. If someone without installed CUDA will try to run CUDA compiled dlls - it won't fallback to CPU inference and may crash (I guess?).

Therefore I need to figure out how to ship plugin with CPU inference and optional CUDA inference. This is what I mean by switch in runtime, because Unity usually load all dlls at start.

@atx-barnes
Copy link

Got it that makes sense. Yeah I might try and recompile the dlls with the -j flag and see what happens in Unity.

@Macoron
Copy link
Owner Author

Macoron commented Nov 21, 2023

Done, though no fallback to CPU yet. Hope whisper.cpp gang will add it in future.

@ehossai2
Copy link

ehossai2 commented Jan 4, 2024

I have pytorch installed, do I need to install CUDA separately?

On the other note, I am little bit struggling to enable CUDA. I read your guidance, unfortunately, the instructions are not clear to me. Can you enlighten me more?

@Macoron
Copy link
Owner Author

Macoron commented Jan 5, 2024

I have pytorch installed, do I need to install CUDA separately?

You would need to install CUDA Toolkit 12.2.0 (download it here). Select your platform and follow instructions. Pytorch isn't relevant.

On the other note, I am little bit struggling to enable CUDA. I read your guidance, unfortunately, the instructions are not clear to me. Can you enlighten me more?

It should be very straightforward. Open your Unity project and find Project Settings window. Next select Whisper category and click enable CUDA.
Screenshot 2024-01-05 at 21 51 37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants