Make the GPU the default on ZeroGPU
Browse filesWith the CUDA provider configured properly the earlier conclusion inverts.
Warm in-window synthesis is 0.10s against ~0.4s on CPU, and end to end:
ru 3.11s -> 0.38s median (8x)
he 0.63s -> 0.48s
en 0.46s -> 0.47s
Russian was the complaint and Russian is where it pays. The 9.3s I measured
before was ORT brute-forcing convolution algorithms with the default
EXHAUSTIVE search, not the per-request session rebuild I blamed it on; the
rebuild is real but only costs ~0.85s.
So invert the flag: GPU by default, BLUE_ZEROGPU_ONNX=0 to opt out. The
remaining cost is variance rather than throughput — when ZeroGPU recycles the
worker that request rebuilds and takes ~3-4s, so a workload of rare one-off
requests may still prefer CPU.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138DB6F6YxWtYWy7WNaLAsU
|
@@ -2372,15 +2372,18 @@ def _gpu_backend() -> str:
|
|
| 2372 |
global _GPU_BACKEND
|
| 2373 |
if _GPU_BACKEND is not None:
|
| 2374 |
return _GPU_BACKEND
|
| 2375 |
-
if _ZERO_GPU and
|
| 2376 |
-
|
| 2377 |
-
|
| 2378 |
-
#
|
| 2379 |
-
#
|
| 2380 |
-
#
|
| 2381 |
-
#
|
| 2382 |
-
#
|
| 2383 |
-
#
|
|
|
|
|
|
|
|
|
|
| 2384 |
_GPU_BACKEND = "cpu"
|
| 2385 |
elif not _ZERO_GPU:
|
| 2386 |
_GPU_BACKEND = "cuda" if TTS.on_cuda else "cpu"
|
|
|
|
| 2372 |
global _GPU_BACKEND
|
| 2373 |
if _GPU_BACKEND is not None:
|
| 2374 |
return _GPU_BACKEND
|
| 2375 |
+
if _ZERO_GPU and os.environ.get("BLUE_ZEROGPU_ONNX", "1").strip().lower() in {
|
| 2376 |
+
"0", "false", "no", "off",
|
| 2377 |
+
}:
|
| 2378 |
+
# Opt-out. GPU is the default because it wins where it matters once the
|
| 2379 |
+
# CUDA provider is configured properly (see the provider options in
|
| 2380 |
+
# BlueTTS.__init__ — the earlier 9 s figure was ORT brute-forcing
|
| 2381 |
+
# convolution algorithms, not the session rebuild I first blamed).
|
| 2382 |
+
# Warm, in-window synthesis is 0.10 s against ~0.4 s on CPU; end to end,
|
| 2383 |
+
# Russian goes 3.11 s -> 0.38 s median. The cost is variance: when
|
| 2384 |
+
# ZeroGPU recycles the worker the session is rebuilt and that request
|
| 2385 |
+
# takes ~3-4 s, so a workload of rare single requests may still prefer
|
| 2386 |
+
# CPU. Set BLUE_ZEROGPU_ONNX=0 for that.
|
| 2387 |
_GPU_BACKEND = "cpu"
|
| 2388 |
elif not _ZERO_GPU:
|
| 2389 |
_GPU_BACKEND = "cuda" if TTS.on_cuda else "cpu"
|