Skip to content
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

Update: Test for Compatibility with Transformers 4.48 #239

Merged
merged 4 commits into from
Jan 10, 2025
Merged

Conversation

rahul-tuli
Copy link
Member

@rahul-tuli rahul-tuli commented Jan 10, 2025

We recently encountered a failure due to the release of Transformers 4.48. Details of the failure can be found here: GitHub Actions Failure.

Cause

The failure occurred because the Llama model definition in Transformers was updated to use a single rotary embedding for the model, replacing the previous implementation where there was one rotary embedding per attention block. This change was introduced in the following commit: Transformers Commit (line 261).

Fix and Validation

Instead of relying o hardcoded values, we count the modules in question now, and check if after quantization config application the number stays the same. Credits to @horheynm for the better fix #238. The test now successfully passes with all versions of Transformers, as demonstrated below:

Transformers 4.47.1

(.venv) ➜ compressed-tensors git:(update-test) ✗ pytest "./tests/test_quantization/lifecycle/test_apply.py::test_apply_quantization_config_tinyllama"
=========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/rahul/compressed-tensors
configfile: pyproject.toml
collected 1 item                                                                                                                                                                                          

tests/test_quantization/lifecycle/test_apply.py .                                                                                                                                                   [100%]

============================================================================================ 1 passed in 3.68s ============================================================================================

Transformers 4.48.0

(.venv) ➜ compressed-tensors git:(update-test) ✗ pytest "./tests/test_quantization/lifecycle/test_apply.py::test_apply_quantization_config_tinyllama"
=========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/rahul/compressed-tensors
configfile: pyproject.toml
collected 1 item                                                                                                                                                                                          

tests/test_quantization/lifecycle/test_apply.py .                                                                                                                                                   [100%]

============================================================================================ 1 passed in 4.08s ============================================================================================

Summary

This update ensures compatibility with the latest Transformers release (4.48) while maintaining support for previous versions. All relevant tests now pass, confirming the fix.

@rahul-tuli rahul-tuli changed the title Update: test for new transformers release Update: Test for Compatibility with Transformers 4.48 Jan 10, 2025
@rahul-tuli rahul-tuli marked this pull request as ready for review January 10, 2025 15:51
@rahul-tuli rahul-tuli self-assigned this Jan 10, 2025
Copy link
Contributor

@kylesayrs kylesayrs left a comment

Choose a reason for hiding this comment

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

Much better

@rahul-tuli rahul-tuli merged commit 9938a6e into main Jan 10, 2025
1 check passed
@rahul-tuli rahul-tuli deleted the update-test branch January 10, 2025 16:43
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