Recognize onnxruntime-windowsml in onnxruntime version detection#13518
Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Open
Recognize onnxruntime-windowsml in onnxruntime version detection#13518Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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