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

Fix NumPy Deprecation Warning for np.bool Usage in attention.py #50

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

conorKotwasinski
Copy link

@conorKotwasinski conorKotwasinski commented Mar 8, 2024

Problem Description

The glide_text2im package currently uses np.bool in attention.py, which has been deprecated since NumPy 1.20. This results in a FutureWarning when using the package and eventually leads to an AttributeError in environments with NumPy versions that have fully removed the np.bool alias.

Proposed Solution

This pull request replaces all instances of np.bool with np.bool_ in the attention.py file. The np.bool_ data type is the recommended replacement for np.bool and is not deprecated. This change ensures compatibility with current and future versions of NumPy without altering the functionality of the glide_text2im package.

Justification

Using np.bool_ ensures that the package remains functional and free of deprecation warnings and errors with NumPy 1.20 and later. This update is necessary to maintain the package's usability in current and future Python environments, fostering a smoother user experience and compatibility with the wider Python ecosystem.

Testing

The modifications have been tested locally to verify that the FutureWarning is resolved and that the glide_text2im package functions as expected with the change. All existing tests pass, and no new functionality has been introduced, minimizing the risk of side effects.

I look forward to your feedback on this pull request. Thank you for maintaining the glide_text2im package and for considering this update to ensure its continued compatibility and performance.

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.

1 participant