Skip to content

voicevox_core python api - dll loading - windows #445

@Leikoe

Description

@Leikoe

質問の内容

sorry for posting in english (I don't speak japanese yet)

The problem:
The python api loads onnxruntime.dll from current directory. I got it working after copying onnxruntime_providers_shared.dll and onnxruntime.dll in the example/python/ directory.

But, only CPU mode works, GPU mode fails with the following error

Traceback (most recent call last):
  File "C:\Users\chach\git\voicevox_core\example\python\run.py", line 78, in <module>
    main()
  File "C:\Users\chach\git\voicevox_core\example\python\run.py", line 33, in main
    core.load_model(SPEAKER_ID)
voicevox_core.VoicevoxError: modelデータ読み込みに失敗しました (C:\Users\chach\AppData\Local\Programs\Python\Python310\lib\site-packages\voicevox_core\model\d0.bin): Failed to create session options: Error calling ONNX Runtime C function: D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1106 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\chach\git\voicevox_core\example\python\onnxruntime_providers_cuda.dll"

copying onnxruntime_providers_cuda.dll in the run.py directory doesn't help either:

Traceback (most recent call last):
  File "C:\Users\chach\git\voicevox_core\example\python\run.py", line 8, in <module>
    import voicevox_core
  File "C:\Users\chach\AppData\Local\Programs\Python\Python310\lib\site-packages\voicevox_core\__init__.py", line 1, in <module>
    from . import _load_dlls  # noqa: F401
  File "C:\Users\chach\AppData\Local\Programs\Python\Python310\lib\site-packages\voicevox_core\_load_dlls.py", line 16, in <module>
    CDLL(str(Path(dll).resolve(strict=True)))
  File "C:\Users\chach\AppData\Local\Programs\Python\Python310\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\chach\git\voicevox_core\example\python\onnxruntime_providers_cuda.dll' (or one of its dependencies). Try using the full path with constructor syntax.
  • would it be possible to load the required dlls from PATH ?
  • would it be possible to bundle required dlls in the .whl like pytorch does ?

VOICEVOXのバージョン

voicevox_core cloned 3/19/2023

OSの種類/ディストリ/バージョン

  • Windows
  • macOS
  • Linux

なるべく詳しく書いてください 記述例:

  • Windows 10 Home x86_64 (21H2 | 19044.2728)
  • python 3.10
  • onnxruntime 1.14.1 cuda

その他

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS 依存:win要議論実行する前に議論が必要そうなもの

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions