Skip to content
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

Restore compatibility with deprecated StableDiffusionOnnxPipeline #1191

Merged
merged 3 commits into from Nov 8, 2022

Conversation

pcuenca
Copy link
Member

@pcuenca pcuenca commented Nov 8, 2022

I think it broke in #552, but it was meant to be deprecated until 1.0.0.

@pcuenca pcuenca requested a review from anton-l November 8, 2022 13:05
@@ -259,6 +259,7 @@ def __call__(
class StableDiffusionOnnxPipeline(OnnxStableDiffusionPipeline):
def __init__(
self,
vae_encoder: OnnxRuntimeModel,
Copy link
Member Author

Choose a reason for hiding this comment

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

Alt 1/2: remove this line

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the old pipeline didn't have an encoder, so let's remove and substitute it with **kwargs

@@ -270,6 +271,7 @@ def __init__(
deprecation_message = "Please use `OnnxStableDiffusionPipeline` instead of `StableDiffusionOnnxPipeline`."
deprecate("StableDiffusionOnnxPipeline", "1.0.0", deprecation_message)
super().__init__(
vae_encoder=vae_encoder,
Copy link
Member Author

Choose a reason for hiding this comment

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

Alt 2/2: vae_encoder=None

Copy link
Member

Choose a reason for hiding this comment

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

None would work with **kwargs as well 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not able to make **kwargs work, it fails later in from_pretrained because it tries to match a module named "kwargs".

In addition, omitting vae_encoder in the __init__ causes an additional warning:

Keyword arguments {'vae_encoder': ['diffusers', 'OnnxRuntimeModel']} not recognized.

So I'd be inclined to leave it as it is here. You are welcome to take another look though :)

@pcuenca
Copy link
Member Author

pcuenca commented Nov 8, 2022

Also, shouldn't we have a vae_encoder here:

class OnnxStableDiffusionPipeline(DiffusionPipeline):
vae_decoder: OnnxRuntimeModel
text_encoder: OnnxRuntimeModel
tokenizer: CLIPTokenizer

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 8, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@anton-l anton-l left a comment

Choose a reason for hiding this comment

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

Thanks a lot for catching this @pcuenca! The alternatives look best IMO :)

@@ -270,6 +271,7 @@ def __init__(
deprecation_message = "Please use `OnnxStableDiffusionPipeline` instead of `StableDiffusionOnnxPipeline`."
deprecate("StableDiffusionOnnxPipeline", "1.0.0", deprecation_message)
super().__init__(
vae_encoder=vae_encoder,
Copy link
Member

Choose a reason for hiding this comment

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

None would work with **kwargs as well 👍

@@ -259,6 +259,7 @@ def __call__(
class StableDiffusionOnnxPipeline(OnnxStableDiffusionPipeline):
def __init__(
self,
vae_encoder: OnnxRuntimeModel,
Copy link
Member

Choose a reason for hiding this comment

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

Yes, the old pipeline didn't have an encoder, so let's remove and substitute it with **kwargs

@anton-l
Copy link
Member

anton-l commented Nov 8, 2022

Also, shouldn't we have a vae_encoder here:

class OnnxStableDiffusionPipeline(DiffusionPipeline):
vae_decoder: OnnxRuntimeModel
text_encoder: OnnxRuntimeModel
tokenizer: CLIPTokenizer

Indeed!

@anton-l
Copy link
Member

anton-l commented Nov 8, 2022

Thanks @pcuenca! Totally forgot about out kwargs complications, disregard my comments 😅

@anton-l anton-l merged commit 614c182 into main Nov 8, 2022
@anton-l anton-l deleted the fix-old-onnx-pipeline branch November 8, 2022 14:13
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
…uggingface#1191)

* Restore compatibility with old ONNX pipeline.

I think it broke in huggingface#552.

* Add missing attribute `vae_encoder`
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.

None yet

3 participants