Skip to content

Commit 4288eff

Browse files
authored
fix: auto-enable CUDA for piper backend when NVIDIA GPU detected (#50)
1 parent 2d19a2e commit 4288eff

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/backend/piper.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ impl TtsBackend for PiperBackend {
145145
}
146146
}
147147

148+
// Enable CUDA if available (NVIDIA GPU)
149+
if std::path::Path::new("/usr/bin/nvidia-smi").exists()
150+
|| std::env::var("CUDA_VISIBLE_DEVICES").is_ok()
151+
{
152+
cmd.arg("--cuda");
153+
}
154+
148155
let mut child = cmd
149156
.stdin(Stdio::piped())
150157
.stdout(Stdio::null())

0 commit comments

Comments
 (0)