Add: Test for ONNX inference code (without PyTorch dependency)

This commit is contained in:
tsukumi
2024-09-23 10:04:02 +09:00
parent 5a82105df3
commit eb5d245903
6 changed files with 104 additions and 22 deletions

View File

@@ -154,6 +154,16 @@ class TTSModel:
f"Model loaded successfully from {self.model_path} to {self.onnx_session.get_providers()[0]} ({time.time() - start_time:.2f}s)"
)
def unload(self) -> None:
"""
音声合成モデルをデバイスからアンロードする。
"""
if self.net_g is not None:
self.net_g = None
if self.onnx_session is not None:
self.onnx_session = None
def get_style_vector(self, style_id: int, weight: float = 1.0) -> NDArray[Any]:
"""
スタイルベクトルを取得する。