-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Restore compatibility with deprecated StableDiffusionOnnxPipeline
#1191
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
Conversation
I think it broke in #552.
| class StableDiffusionOnnxPipeline(OnnxStableDiffusionPipeline): | ||
| def __init__( | ||
| self, | ||
| vae_encoder: OnnxRuntimeModel, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
| deprecation_message = "Please use `OnnxStableDiffusionPipeline` instead of `StableDiffusionOnnxPipeline`." | ||
| deprecate("StableDiffusionOnnxPipeline", "1.0.0", deprecation_message) | ||
| super().__init__( | ||
| vae_encoder=vae_encoder, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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 :)
|
Also, shouldn't we have a diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion.py Lines 19 to 22 in 5e27fc7
|
|
The documentation is not available anymore as the PR was closed or merged. |
anton-l
left a comment
There was a problem hiding this 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 :)
| deprecation_message = "Please use `OnnxStableDiffusionPipeline` instead of `StableDiffusionOnnxPipeline`." | ||
| deprecate("StableDiffusionOnnxPipeline", "1.0.0", deprecation_message) | ||
| super().__init__( | ||
| vae_encoder=vae_encoder, |
There was a problem hiding this comment.
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 👍
| class StableDiffusionOnnxPipeline(OnnxStableDiffusionPipeline): | ||
| def __init__( | ||
| self, | ||
| vae_encoder: OnnxRuntimeModel, |
There was a problem hiding this comment.
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
Indeed! |
|
Thanks @pcuenca! Totally forgot about out kwargs complications, disregard my comments 😅 |
…uggingface#1191) * Restore compatibility with old ONNX pipeline. I think it broke in huggingface#552. * Add missing attribute `vae_encoder`
I think it broke in #552, but it was meant to be deprecated until
1.0.0.