Skip to content

Commit

Permalink
reintroduced cuda support
Browse files Browse the repository at this point in the history
Signed-off-by: David Anyatonwu <[email protected]>
  • Loading branch information
onyedikachi-david committed Sep 17, 2024
1 parent 7c46091 commit d8b8621
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions screenpipe-audio/src/stt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,24 @@ impl WhisperModel {
}

fn get_optimal_device() -> Result<Device> {
if let Ok(device) = Device::new_metal(0) {
info!("Using Metal GPU");
Ok(device)
} else {
info!("Metal not available, falling back to CPU");
Ok(Device::Cpu)
#[cfg(target_os = "macos")]
{
if let Ok(device) = Device::new_metal(0) {
info!("Using Metal GPU");
return Ok(device);
}
}

#[cfg(not(target_os = "macos"))]
{
if let Ok(device) = Device::new_cuda(0) {
info!("Using CUDA GPU");
return Ok(device);
}
}

info!("GPU not available, falling back to CPU");
Ok(Device::Cpu)
}

}
Expand Down

0 comments on commit d8b8621

Please sign in to comment.