Skip to content

Fixing missing provider options argument #11397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

urpetkov-amd
Copy link

What does this PR do?

This PR adding support for provider options argument for diffusers pipelines. In previous approach, not all of the necessary code had been added following those two closed PRs:
#10719
#10661

Provider options argument is missing on two places: diffusers/src/diffusers/pipelines/onnx_utils.py lines 177. and 193.

ONNXRuntime Inference Session( ) method accepts provider options as a list of dictionary, change on: diffusers/src/diffusers/pipelines/onnx_utils.py line 79.

Fixes missing provider options argument.

Before submitting

Who can review?

@yiyixuxu
@asomoza
@sayakpaul
@DN6

@sayakpaul sayakpaul requested a review from echarlaix April 23, 2025 15:35
@yiyixuxu yiyixuxu requested a review from Copilot April 23, 2025 16:23
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the missing provider options argument for diffusers pipelines, ensuring that the ONNX Runtime InferenceSession receives the expected list of provider options.

  • Update the provider_options parameter to a list in the InferenceSession instantiation.
  • Propagate provider_options from kwargs in both local and hub model loading.

Comment on lines 78 to 79
return ort.InferenceSession(
path, providers=[provider], sess_options=sess_options, provider_options=provider_options
path, providers=[provider], sess_options=sess_options, provider_options=[provider_options]
Copy link
Preview

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping provider_options in a list may result in [None] if provider_options is not provided. Consider defaulting to an empty list or checking for a non-null value before wrapping.

Copilot uses AI. Check for mistakes.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@urpetkov-amd
Copy link
Author

@yiyixuxu Added changes for None case and explained second Copilot suggestions.

@@ -75,6 +75,11 @@ def load_model(path: Union[str, Path], provider=None, sess_options=None, provide
logger.info("No onnxruntime provider specified, using CPUExecutionProvider")
provider = "CPUExecutionProvider"

if provider_options is None:
provider_options = []
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

Suggested change
else:
elif not isinstance(provider_options, list):

@urpetkov-amd urpetkov-amd requested a review from yiyixuxu April 25, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants