perf(asr): Parakeet peak VRAM 6.1 -> 4.6 GB with the same transcripts
Benchmarked in the prod container on 10 real user videos (40 min of audio, EN/ES/PT/FR-AR, 4,850 words) before changing anything: config peak VRAM ASR time words != prod ts drift prod (batch 8) 6.1 GB 32 s - - batch 4 + lean arena 4.6 GB 38 s 1 (*) 0.1 ms batch 2 + lean arena 4.1 GB 40 s dropped a sentence int8 3.9 GB 350 s 11.7 % 168 ms (*) outside the mixed-language clip, which goes to whisper in prod anyway. Ship batch 4 with the arena growing only by what is requested and no max cuDNN workspace (those two alone change nothing in the output). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4cc2fe32e0
commit
fdad2a46fa
3 changed files with 46 additions and 5 deletions
|
|
@ -488,6 +488,13 @@ per hour at peak with `MAX_CONCURRENT_JOBS=8`):
|
||||||
(`main.transcribe_video` → `release_models()`). Before, a job kept Parakeet's
|
(`main.transcribe_video` → `release_models()`). Before, a job kept Parakeet's
|
||||||
onnxruntime CUDA arena (~4-6 GB) for its whole render; TransNetV2 also
|
onnxruntime CUDA arena (~4-6 GB) for its whole render; TransNetV2 also
|
||||||
`empty_cache()`s after each pass.
|
`empty_cache()`s after each pass.
|
||||||
|
- **Parakeet runs lean** (`transcribe_backends.parakeet_providers`,
|
||||||
|
`PARAKEET_VAD_BATCH`=4): 4 VAD segments per encoder batch instead of 8, CUDA
|
||||||
|
arena `kSameAsRequested`, no max cuDNN workspace. Peak per transcription
|
||||||
|
6.1 → 4.6 GB with the same words (benchmark 22-sep-2026: 10 real videos,
|
||||||
|
4,850 words, 1 word changed outside a clip that goes to whisper anyway).
|
||||||
|
Batch 2 dropped a sentence and int8 was 11x slower with 11.7% of words
|
||||||
|
different: both rejected.
|
||||||
- **Host-wide transcription slots** (`transcribe_backends.host_asr_slot`,
|
- **Host-wide transcription slots** (`transcribe_backends.host_asr_slot`,
|
||||||
`ASR_HOST_SLOTS`, default 2): flock files `output/.asr-gpu-N.lock`, shared by
|
`ASR_HOST_SLOTS`, default 2): flock files `output/.asr-gpu-N.lock`, shared by
|
||||||
every job process and by both containers of a deploy.
|
every job process and by both containers of a deploy.
|
||||||
|
|
|
||||||
|
|
@ -333,3 +333,16 @@ class TestHostAsrSlot:
|
||||||
import transcribe_backends as tb
|
import transcribe_backends as tb
|
||||||
with tb.host_asr_slot(slots=0, lock_dir=str(tmp_path)) as s:
|
with tb.host_asr_slot(slots=0, lock_dir=str(tmp_path)) as s:
|
||||||
assert s._fh is None
|
assert s._fh is None
|
||||||
|
|
||||||
|
|
||||||
|
class TestParakeetMemorySettings:
|
||||||
|
def test_vad_batch_default_is_the_benchmarked_one(self):
|
||||||
|
import transcribe_backends as tb
|
||||||
|
assert tb.PARAKEET_VAD_BATCH == 4
|
||||||
|
|
||||||
|
def test_cuda_provider_is_lean_with_cpu_fallback(self):
|
||||||
|
import transcribe_backends as tb
|
||||||
|
(name, opts), cpu = tb.parakeet_providers()
|
||||||
|
assert name == "CUDAExecutionProvider" and cpu == "CPUExecutionProvider"
|
||||||
|
assert opts["arena_extend_strategy"] == "kSameAsRequested"
|
||||||
|
assert opts["cudnn_conv_use_max_workspace"] == "0"
|
||||||
|
|
|
||||||
|
|
@ -256,17 +256,38 @@ _parakeet_model = None
|
||||||
_parakeet_lock = threading.Lock()
|
_parakeet_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
|
# How many VAD segments (up to 20 s each) the encoder takes per batch. The
|
||||||
|
# library default is 8; 4 cuts the peak VRAM of a transcription from ~6.1 to
|
||||||
|
# ~4.6 GB for the same words. Benchmarked in prod on 22-sep-2026 over 10 real
|
||||||
|
# user videos (40 min of audio, EN/ES/PT/FR-AR, 4,850 words): batch 4 changed
|
||||||
|
# 1 word outside the mixed-language clip (which goes to whisper in prod anyway),
|
||||||
|
# 0.1 ms mean timestamp drift, +3 s per 20-min video. Batch 2 saved another
|
||||||
|
# 0.5 GB but dropped a whole sentence; int8 was 11x slower on this GPU with
|
||||||
|
# 11.7% of words different. Don't go below 4 without re-running that check.
|
||||||
|
PARAKEET_VAD_BATCH = int(os.environ.get("PARAKEET_VAD_BATCH", "4"))
|
||||||
|
|
||||||
|
|
||||||
|
def parakeet_providers():
|
||||||
|
"""onnxruntime providers for Parakeet. The arena grows only by what is
|
||||||
|
asked and cuDNN gets no oversized workspace: same numerics (identical
|
||||||
|
transcripts in the benchmark), less memory held."""
|
||||||
|
cuda_opts = {
|
||||||
|
"arena_extend_strategy": "kSameAsRequested",
|
||||||
|
"cudnn_conv_use_max_workspace": "0",
|
||||||
|
"cudnn_conv_algo_search": "HEURISTIC",
|
||||||
|
}
|
||||||
|
return [("CUDAExecutionProvider", cuda_opts), "CPUExecutionProvider"]
|
||||||
|
|
||||||
|
|
||||||
def _get_parakeet_model():
|
def _get_parakeet_model():
|
||||||
global _parakeet_model
|
global _parakeet_model
|
||||||
with _parakeet_lock:
|
with _parakeet_lock:
|
||||||
if _parakeet_model is None:
|
if _parakeet_model is None:
|
||||||
import onnx_asr
|
import onnx_asr
|
||||||
model = onnx_asr.load_model(
|
model = onnx_asr.load_model(PARAKEET_MODEL_ID, providers=parakeet_providers())
|
||||||
PARAKEET_MODEL_ID,
|
|
||||||
providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
|
|
||||||
)
|
|
||||||
vad = onnx_asr.load_vad("silero")
|
vad = onnx_asr.load_vad("silero")
|
||||||
_parakeet_model = model.with_vad(vad).with_timestamps()
|
_parakeet_model = model.with_vad(
|
||||||
|
vad, batch_size=PARAKEET_VAD_BATCH).with_timestamps()
|
||||||
return _parakeet_model
|
return _parakeet_model
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue