Skip to content

Fix _patch_transformers_hybrid_cache also for peft#4820

Merged
albertvillanova merged 3 commits intohuggingface:mainfrom
albertvillanova:fix-compat-patch-transformers
Jan 14, 2026
Merged

Fix _patch_transformers_hybrid_cache also for peft#4820
albertvillanova merged 3 commits intohuggingface:mainfrom
albertvillanova:fix-compat-patch-transformers

Conversation

@albertvillanova
Copy link
Copy Markdown
Member

@albertvillanova albertvillanova commented Jan 13, 2026

Fix _patch_transformers_hybrid_cache also for peft:

This PR updates the _patch_transformers_hybrid_cache function to improve compatibility with transformers v5 and ensure smoother integration with both liger_kernel and peft dependencies. The patch now checks for both packages' versions and updates documentation to reflect recent upstream fixes.

Dependency compatibility improvements:

  • Updated the patch to check both liger_kernel and peft versions, ensuring compatibility with transformers v5 by applying the fix if either is below their respective fixed versions (liger_kernel<0.6.5 or peft<0.18.0).
  • Enhanced the docstring to clarify that the patch addresses compatibility for both liger_kernel and peft, and that it can be removed once both dependencies are upgraded past their fixed versions.
  • Improved the warning message to reference "transformers HybridCache compatibility" instead of just "liger_kernel", making the intent clearer when an exception occurs.

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

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

nice, good catch

@albertvillanova albertvillanova merged commit f39ecd3 into huggingface:main Jan 14, 2026
6 of 10 checks passed
marcandrelarochelle pushed a commit to marcandrelarochelle/trl that referenced this pull request Mar 25, 2026
songhappy pushed a commit to songhappy/trl that referenced this pull request Apr 20, 2026
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