From 8eeff3a01c9df1578923d358ad3169bd1e6962dd Mon Sep 17 00:00:00 2001 From: louistiti Date: Sun, 30 Jun 2024 16:54:59 +0800 Subject: [PATCH] feat(python tcp server): map speech synthesis hardware device choice to settings --- tcp_server/settings.json | 3 ++- tcp_server/src/lib/tcp_server.py | 2 +- tcp_server/src/lib/tts/api.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tcp_server/settings.json b/tcp_server/settings.json index 19c94fdb..3f60767e 100644 --- a/tcp_server/settings.json +++ b/tcp_server/settings.json @@ -4,7 +4,8 @@ "device": "auto" }, "tts": { - "model_file_name": "EN-Leon-V1_1-G_600000.pth" + "model_file_name": "EN-Leon-V1_1-G_600000.pth", + "device": "auto" }, "wake_word": {} } diff --git a/tcp_server/src/lib/tcp_server.py b/tcp_server/src/lib/tcp_server.py index add16528..4aa4afa1 100644 --- a/tcp_server/src/lib/tcp_server.py +++ b/tcp_server/src/lib/tcp_server.py @@ -58,7 +58,7 @@ class TCPServer: return self.tts = TTS(language='EN', - device='cpu', + device=get_settings('tts')['device'], config_path=TTS_MODEL_CONFIG_PATH, ckpt_path=TTS_MODEL_PATH ) diff --git a/tcp_server/src/lib/tts/api.py b/tcp_server/src/lib/tts/api.py index a8b72334..128c3fac 100644 --- a/tcp_server/src/lib/tts/api.py +++ b/tcp_server/src/lib/tts/api.py @@ -18,6 +18,7 @@ from ..utils import is_macos class TTS(nn.Module): def __init__(self, language, + # auto, cpu, cuda, mps device='auto', use_hf=True, config_path=None,