Skip to content

Recognize onnxruntime-windowsml in onnxruntime version detection#13518

Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L:fix-onnxruntime-windowsml
Open

Recognize onnxruntime-windowsml in onnxruntime version detection#13518
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L:fix-onnxruntime-windowsml

Conversation

@Ricardo-M-L
Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #13062.

`diffusers.utils.import_utils` probes for onnxruntime by first calling `find_spec("onnxruntime")` and then iterating a list of package names to resolve the installed version via `importlib_metadata.version(pkg)`. If none of the candidates match, `_onnxruntime_version` stays `None` and `_onnx_available` is reset to `False`, so ONNX-dependent code paths are silently disabled even though `import onnxruntime` succeeds.

Users who install `onnxruntime-windowsml` (the Windows ML variant, https://pypi.org/project/onnxruntime-windowsml/) hit exactly this case: the module is importable but the distribution name isn't in the candidate tuple.

Add `onnxruntime-windowsml` next to the other vendor-specific wheels (`onnxruntime-directml`, `onnxruntime-cann`, `onnxruntime-openvino`, `onnxruntime-qnn`, `onnxruntime-rocm`, …).

Before submitting

Who can review?

@asomoza @DN6

When users install the Windows ML onnxruntime variant
(`pip install onnxruntime-windowsml`), `find_spec("onnxruntime")` still
resolves successfully, but none of the package names in the
metadata-lookup fallback match, so `importlib_metadata.version(pkg)`
fails for every candidate and `_onnx_available` ends up False (see huggingface#13062).

Add `onnxruntime-windowsml` to the candidate list alongside the other
vendor-specific wheels (DirectML, CANN, OpenVINO, …) so installations
that ship only this variant are detected.

Fixes huggingface#13062
@github-actions github-actions Bot added utils size/S PR with diff < 50 LOC labels Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not support onnxruntime-windowsml

1 participant