-
Notifications
You must be signed in to change notification settings - Fork 69
fix torch dtype #1217
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 torch dtype #1217
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this 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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
…into fix_torch_dtype # Conflicts: # auto_round/utils/common.py
for more information, see https://pre-commit.ci
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
xin3he
left a comment
There was a problem hiding this 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
for more information, see https://pre-commit.ci
…into fix_torch_dtype # Conflicts: # test/test_ark/test_model.py
No description provided.