Skip to content

Fix Python 3.14+ compatibility for NORMALIZED_CONFIG_CLASS#2409

Open
drewd789 wants to merge 1 commit intohuggingface:mainfrom
drewd789:fix/python314-normalized-config-class
Open

Fix Python 3.14+ compatibility for NORMALIZED_CONFIG_CLASS#2409
drewd789 wants to merge 1 commit intohuggingface:mainfrom
drewd789:fix/python314-normalized-config-class

Conversation

@drewd789
Copy link

@drewd789 drewd789 commented Feb 25, 2026

What does this PR do?

Fixes Python 3.14+ compatibility issue where exporting models fails with:
TypeError: NormalizedConfig.init() got multiple values for argument 'allow_new'

Root cause: Python 3.14 made functools.partial a method descriptor (gh-121027).
When NORMALIZED_CONFIG_CLASS is defined via with_args(), accessing it via self.X
triggers the descriptor protocol and converts it to a bound method.
Fix: access via self.class.X to bypass the descriptor protocol.

Testing

Tested with manual export commands:

optimum-cli export openvino --model hf-internal-testing/tiny-random-gpt2 --task text-generation-with-past output_dir

Results:

  • Python 3.14 + fixed code: ✅ Export succeeds
  • Python 3.14 + PyPI 2.1.0: ❌ TypeError (confirms bug)
  • Python 3.12 + fixed code: ✅ Export succeeds (no regression)

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