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 activation lookup with Python 3.12.3 #375

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

danieldk
Copy link
Contributor

Description

We used the metaclass EnumMeta/EnumType to override reporting of missing enum values (to give the full set of supported activations). However, in Python 3.12.3, the default value of the name parameter of EnumType.__call__ method was changed from None to _not_given:

python/cpython@d771729

Even though this is a public API (which now uses a private default value), it seems too risky to continue using it. So in this change, we implement Enum.__mising__ instead for the improved error reporting.

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.

We used the metaclass `EnumMeta`/`EnumType` to override reporting of
missing enum values (to give the full set of supported activations).
However, in Python 3.12.3, the default value of the `name` parameter of
`EnumType.__call__` method was changed from `None` to `_not_given`:

python/cpython@d771729

Even though this is a public API (which now uses a private default
value), it seems too risky to continue using it. So in this change, we
implement `Enum.__mising__` instead for the improved error reporting.
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

LGTM! Is there a unit test for this behaviour?

@danieldk danieldk merged commit e7e7e9d into explosion:main Apr 17, 2024
7 of 8 checks passed
@danieldk
Copy link
Contributor Author

LGTM! Is there a unit test for this behaviour?

Not yet, but it sounds good to have this. I'll do a PR for that after getting new releases for 2.0.x and 1.3.x out.

@danieldk danieldk deleted the bugfix/python-3.12.3-enum branch April 17, 2024 14:56
danieldk added a commit to danieldk/curated-transformers that referenced this pull request Apr 17, 2024
We used the metaclass `EnumMeta`/`EnumType` to override reporting of
missing enum values (to give the full set of supported activations).
However, in Python 3.12.3, the default value of the `name` parameter of
`EnumType.__call__` method was changed from `None` to `_not_given`:

python/cpython@d771729

Even though this is a public API (which now uses a private default
value), it seems too risky to continue using it. So in this change, we
implement `Enum.__mising__` instead for the improved error reporting.
danieldk added a commit that referenced this pull request Apr 17, 2024
* Fix activation lookup with Python 3.12.3 (#375)

We used the metaclass `EnumMeta`/`EnumType` to override reporting of
missing enum values (to give the full set of supported activations).
However, in Python 3.12.3, the default value of the `name` parameter of
`EnumType.__call__` method was changed from `None` to `_not_given`:

python/cpython@d771729

Even though this is a public API (which now uses a private default
value), it seems too risky to continue using it. So in this change, we
implement `Enum.__mising__` instead for the improved error reporting.

* Set version to 1.3.2

* Adjust two cross-tests for changes in HF transformers (#367)

* Fix `test_rotary_embeddings_against_hf` for latest transformers

* xfail test because HfFileSystem is currently broken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants