From db5dea460d4dc9b24670ac2df4b9bbd4ee3fadf1 Mon Sep 17 00:00:00 2001 From: kazukiotsuka Date: Thu, 7 Mar 2024 10:46:36 +0900 Subject: [PATCH] Enable to designate GPU device_id --- src/python_run/piper/voice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python_run/piper/voice.py b/src/python_run/piper/voice.py index 0360c273..f392f0f8 100644 --- a/src/python_run/piper/voice.py +++ b/src/python_run/piper/voice.py @@ -26,6 +26,7 @@ def load( model_path: Union[str, Path], config_path: Optional[Union[str, Path]] = None, use_cuda: bool = False, + device_id: int = 0, ) -> "PiperVoice": """Load an ONNX model and config.""" if config_path is None: @@ -42,6 +43,7 @@ def load( {"cudnn_conv_algo_search": "HEURISTIC"}, ) ] + pvovider_options = [{'device_id': device_id}] else: providers = ["CPUExecutionProvider"] @@ -51,6 +53,7 @@ def load( str(model_path), sess_options=onnxruntime.SessionOptions(), providers=providers, + provider_options=provider_options, ), )