Skip to content

Fix Python 3.14+ compatibility for NORMALIZED_CONFIG_CLASS#2409

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

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

Conversation

@drewd789

@drewd789 drewd789 commented Feb 25, 2026

Copy link
Copy Markdown

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)

@github-actions

Copy link
Copy Markdown

This PR has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

@github-actions github-actions Bot added the Stale label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant