refactor: replace Kokoro-82M with suno/bark for TTS, update HF cache path, and add model warmup on startup.

This commit is contained in:
“ydy0615”
2026-04-06 13:40:41 +08:00
parent 7985fe9641
commit caf1ac1c01
8 changed files with 143 additions and 18 deletions
+4 -3
View File
@@ -22,7 +22,7 @@ logging.basicConfig(
logger = logging.getLogger("api_benchmarker")
# Constants
DEFAULT_BASE_URL = "https://api.imageteach.tech:8002"
DEFAULT_BASE_URL = "http://localhost:8001"
DEFAULT_API_KEY = "your-secret-key-here"
CHARS_PER_TOKEN = 4
@@ -31,7 +31,8 @@ def get_dummy_base64_image():
return "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="
def get_dummy_base64_audio():
return "UklGRigAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQQAAAAAAA=="
# A bit longer dummy audio to pass validation (44 bytes header + some data)
return "UklGRigAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQQAAAAAAA" + "A" * 100 + "=="
def generate_context_text(tokens: int) -> str:
"""Generate synthetic text of approximately 'tokens' tokens."""
@@ -191,7 +192,7 @@ class ApiBenchmarker:
elif task_type == "tts":
metric = await self._execute_request(client, name, "POST", "/v1/tts-asr/tts", json={
"text": "This is a performance benchmark for the text to speech engine.",
"voice": "af_bella",
"voice": "v2/en_speaker_6",
"format": "wav"
})
elif task_type == "asr":