Skip to content

Introduce DeprecatedPipelineMixin to simplify pipeline deprecation process #11596

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 8 commits into
base: main
Choose a base branch
from

Conversation

DN6
Copy link
Collaborator

@DN6 DN6 commented May 21, 2025

What does this PR do?

Realised that our current deprecation process as seen in this PR: #11354 is quite a big maintenance burden since it isn't trivial to prevent imports from breaking. We have to update a lot of loading code to account for the deprecated pipeline module which is less than ideal.

This PR

  • Introduces a DeprecatedPipelineMixin that can be added to Pipelines that need to be deprecated
  • Add a _last_supported_version class attribute so that it's clear that pipelines may not work as expected past this version.
  • Updates PipelineTesterMixin to skip tests with this Mixin

Now no other changes to the codebase should be required when deprecating pipelines. Will close #11354 in favour of this PR.

Fixes # (issue)

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@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.

@DN6 DN6 requested review from yiyixuxu, sayakpaul and a-r-r-o-w May 21, 2025 12:57
Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Extremely good!

If we feel the need to deprecate some pipelines in the next quarter we can also involve the community for that.

Comment on lines +1118 to +1124
# Skip tests for pipelines that inherit from DeprecatedPipelineMixin
from diffusers.pipelines.pipeline_utils import DeprecatedPipelineMixin

if hasattr(self, "pipeline_class") and issubclass(self.pipeline_class, DeprecatedPipelineMixin):
import pytest

pytest.skip(reason=f"Deprecated Pipeline: {self.pipeline_class.__name__}")
Copy link
Member

Choose a reason for hiding this comment

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

Very nice!

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.

3 participants