Skip to content

fix compatible pipeline_utils.py with different python version #10762

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

Closed

Conversation

rebel-kblee
Copy link
Contributor

@rebel-kblee rebel-kblee commented Feb 11, 2025

What does this PR do?

In Python versions less than 3.10, the typing package does not have the name attribute for formats like List and Tuple. As a result, an issue occurs in diffusers versions (>=0.32.2).

This PR aims to resolve that issue.

Fixes # (issue)
issue #10763

Before submitting

Who can review?

@sayakpaul

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.

@rebel-kblee
Copy link
Contributor Author

rebel-kblee commented Feb 11, 2025

#10763 (fix reproduce code)

Copy link

@joangava joangava left a comment

Choose a reason for hiding this comment

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

if isinstance(expected_type, enum.EnumMeta):
_expected_class_types.extend(expected_type.members.keys())
else:
_expected_class_types.append(expected_type.name)
_expected_class_types.append(
expected_type.name if sys.version_info >= (3, 10)
else getattr(expected_type, 'origin', expected_type).name
)

        _is_valid_type = class_obj.__class__.__name__ in _expected_class_types
        if not _is_valid_type:

@rebel-kblee rebel-kblee deleted the fix_compatible_pipeline_utils branch February 24, 2025 02:27
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.

2 participants