[Perf][TTS] Optimize cosyvoice TTFP and throughput using TensorRT (#4168)

Signed-off-by: Yuekai Zhang <zhangyuekai@foxmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yuekai ZhangandClaude Opus 4.8 authored and GitHub committed 2026-06-10 16:42:34 +08:00
1 parent 57c8f3abfc
commit f1bf544208
11 files changed
+786 -87

No files matched your search

@@ -84,6 +84,11 @@ def _make_code2wav_model(
token_mel_ratio=2 if with_stride_cfg else 0,
)
model.code2wav = _DummyCode2Wav(vocab_size=4, num_samples=num_samples, outputs=outputs)
# Short-circuit the lazy TensorRT estimator swap: these tests exercise the
# forward audio logic, not the TRT path. On a GPU CI runner the swap would
# otherwise run and dereference ``self.model_dir`` (only set in __init__,
# which this fixture bypasses via object.__new__).
model._code2wav_trt_done = True
model.source_cache_len = 4
model.speech_window = torch.hamming_window(8, periodic=False)
model._stream_audio_cache_by_req = {}