Fails to run the scripts.
Ph0rk0z opened this issue · 6 comments
I get this error when I try to run either py.. everything appeared to install correctly.
(sd_env_conv) G:\SD\sd3>python diffusers_to_onnx_optim.py --model_path "stabilityai/stable-diffusion-2-1-base" --output_
path "./model/sd2_1base-fp32"
Traceback (most recent call last):
File "G:\SD\sd3\diffusers_to_onnx_optim.py", line 46, in <module>
from diffusers.models import AutoencoderKL
File "G:\SD\sd3\sd_env_conv\lib\site-packages\diffusers\__init__.py", line 4, in <module>
from .onnx_utils import OnnxRuntimeModel
File "G:\SD\sd3\sd_env_conv\lib\site-packages\diffusers\onnx_utils.py", line 31, in <module>
import onnxruntime as ort
File "G:\SD\sd3\sd_env_conv\lib\site-packages\onnxruntime\__init__.py", line 55, in <module>
raise import_capi_exception
File "G:\SD\sd3\sd_env_conv\lib\site-packages\onnxruntime\__init__.py", line 23, in <module>
from onnxruntime.capi._pybind_state import (
File "G:\SD\sd3\sd_env_conv\lib\site-packages\onnxruntime\capi\_pybind_state.py", line 33, in <module>
from .onnxruntime_pybind11_state import * # noqa
ImportError: DLL load failed while importing onnxruntime_pybind11_state: The specified module could not be found.
Hi, are you possibly not on Windows 10 or on an old patch level? To my knowledge only Windows 10 comes with DirectML by default (as long as the patch level is recent enough even). ONNX Runtime would only detect missing DirectML during runtime.
I think it's possible to get DirectML on Windows 8.1 (but I don't think on anything before that) but you may bump into further compatibility issues as your Direct X version cannot be the latest (again, to my knowledge only on Windows 10 and later) so ONNX Runtime may not support the full ONNX opset and hence would break when running the models.
Yea.. I am on 8.1 64 still. I'm not sure how to get it on 8.1.. maybe install nuget and try to pull the package?
There's the Microsoft.AI.DirectML NuGet package: https://www.nuget.org/packages/Microsoft.AI.DirectML/ It supposedly works for older versions of Windows. A lot of stuff on the pages is pretty ambiguous though as it only talks about Direct X 12. DirectML did definitely originally run on 8.1 so one of the downloadable packages must work.
I think I've "solved" the mystery. When it launched it worked on Windows 8.1 but they stated the following: "This redistributable path enables Windows ML support for CPU inference on Windows versions 8.1 and newer, and GPU hardware-acceleration on Windows 10 1709 and newer."
Clearly the terms DirectML and WindowsML have been used ambiguously after that which leads to existence of pages claiming you can run DirectML on Windows 8.1 despite the requirement of Direct X 12 which you can only get on Windows 10.
So unfortunately Windows 8.1 can't run ONNX Runtime with GPU which will be your problem. You can only run ONNX Runtime on CPU (too slow to be any good).
You can try SHARK. Your success there is mainly based on how up to date your Vulkan driver is. May be a challenge too on Win 8.1 of course.
Only other alternative is moving to Windows 10 I'm afraid.
The DLL is also present in the onnxruntime\capi folder and running on CPU returns the same error.. either way you are right that it would probably only execute on CPU if I found what is wrong.
I think linux is my only option besides upgrading. Shark has been generating a while and I've got nothing.