Skip to content

COPY OF 2381#2393

Draft
xiaoyu-work wants to merge 2 commits intomainfrom
fix/auto-opt-transformers5
Draft

COPY OF 2381#2393
xiaoyu-work wants to merge 2 commits intomainfrom
fix/auto-opt-transformers5

Conversation

@xiaoyu-work
Copy link
Copy Markdown
Collaborator

Describe your changes

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

(Optional) Issue link

Lidang-Jiang and others added 2 commits April 5, 2026 16:11
transformers 5.0 removed DynamicCache.from_legacy_cache() and changed
the cache API so that past_key_values must be a Cache object. The legacy
(non-dynamo) ONNX export path passes list-format past_key_values which
causes AttributeError during model tracing.

Add an early check in _convert_model_on_device to raise a clear error
message directing users to --use_model_builder or --use_dynamo_exporter.
Also guard _patch_model_if_necessary to skip on transformers >= 5.0.

Fixes #2335

Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
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.

3 participants