savbell / whisper-writer

💬📝 A small dictation app using OpenAI's Whisper speech recognition model.
GNU General Public License v3.0
244 stars 40 forks source link

Fix: Graceful Degradation to CPU if CUDA isn't available #30

Closed KernAlan closed 5 months ago

KernAlan commented 5 months ago

Issue

https://github.com/savbell/whisper-writer/issues/29

Solution

Include a check using torch if CUDA is available. If it's not, gracefully degrade to cpu.

Testing

Config json set to auto. But the torch cuda check fails, and the model gracefully degrades to cpu:

image

savbell commented 5 months ago

Thanks for the PR! :)

One request: Can you add back the compute_type parameter when running on the CPU? That way, someone can set it to float32 to avoid the warning that comes up (more info: https://opennmt.net/CTranslate2/quantization.html). Thanks!

KernAlan commented 5 months ago

Done!