Skip to content

Conversation

@wenhuach21
Copy link
Contributor

No description provided.

@wenhuach21 wenhuach21 requested review from Copilot, n1ck-guo and yiliu30 and removed request for n1ck-guo January 4, 2026 07:12
@wenhuach21 wenhuach21 requested a review from xin3he January 4, 2026 07:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a compatibility issue with torch dtype parameter naming in transformers library by implementing a monkey patch. The change ensures the codebase works across different versions of transformers (before and after version 4.56.0), where the parameter name for specifying torch dtype changed from torch_dtype to dtype.

  • Adds a decorator-based parameter renaming mechanism to handle the torch dtype parameter name change
  • Implements monkey patching for transformers AutoModelForCausalLM to maintain compatibility across versions
  • Automatically applies the monkey patch at module initialization

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
auto_round/utils/common.py Adds rename_kwargs decorator and monkey patching functions to handle torch dtype parameter compatibility
auto_round/init.py Imports and executes the monkey patch at module initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wenhuach21 wenhuach21 mentioned this pull request Jan 4, 2026
wenhuach21 and others added 9 commits January 4, 2026 15:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…into fix_torch_dtype

# Conflicts:
#	auto_round/utils/common.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@xin3he xin3he left a comment

Choose a reason for hiding this comment

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

This monkey_patch_transformers is really cool!

…into fix_torch_dtype

# Conflicts:
#	test/test_ark/test_model.py
@wenhuach21 wenhuach21 merged commit 46aec78 into main Jan 5, 2026
28 checks passed
@wenhuach21 wenhuach21 deleted the fix_torch_dtype branch January 5, 2026 03:31
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.

5 participants