huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
26.2k stars 5.4k forks source link

[Maintenance] Updating fast pipeline tests to rely on common `PipelineTesterMixin` #1573

Open anton-l opened 1 year ago

anton-l commented 1 year ago

Context

The #1526 PR implemented a PipelineTesterMixin with common fast tests for pipelines to inherit: saving/loading, casting to fp16, checking tuple outputs, attention slicing, etc. To support PipelineTesterMixin, a fast tests class has to:

  1. Inherit form the mixin https://github.com/huggingface/diffusers/blob/02d83c9ff1b93f2c6f9c94f9369b3e4bc1ba8ce7/tests/pipelines/stable_diffusion/test_stable_diffusion.py#L45
  2. Implement pipeline_class https://github.com/huggingface/diffusers/blob/02d83c9ff1b93f2c6f9c94f9369b3e4bc1ba8ce7/tests/pipelines/stable_diffusion/test_stable_diffusion.py#L46
  3. Implement get_dummy_components() https://github.com/huggingface/diffusers/blob/02d83c9ff1b93f2c6f9c94f9369b3e4bc1ba8ce7/tests/pipelines/stable_diffusion/test_stable_diffusion.py#L48-L53
  4. Implement get_dummy_inputs(device, seed) https://github.com/huggingface/diffusers/blob/02d83c9ff1b93f2c6f9c94f9369b3e4bc1ba8ce7/tests/pipelines/stable_diffusion/test_stable_diffusion.py#L102-L109

And that's it! Then the rest of the fast tests can either be trimmed (like checking tuple outputs and fp16, bacause they're already in the PipelineTesterMixin), or updated to use get_dummy_components() and get_dummy_inputs() instead of self.dummy_unet, self.dummy_text_encoder, self.dummy_image.

The list of tests to update

cc @patrickvonplaten @patil-suraj @pcuenca @williamberman

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

patrickvonplaten commented 1 year ago

Let's maybe solve this PR after: https://github.com/huggingface/diffusers/pull/1924

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

patrickvonplaten commented 1 year ago

Actually ok for me to only add the PipelineTesterMixin to the following two:

patrickvonplaten commented 1 year ago

cc @williamberman do you maybe have some time here?

williamberman commented 1 year ago

@patrickvonplaten yep!

patrickvonplaten commented 1 year ago

Closing this as we won't have time in the near future I'm afraid