fix: forward-compatible _patched_get_init_context for transformers v5.3.0#1504
Merged
fix: forward-compatible _patched_get_init_context for transformers v5.3.0#1504
Conversation
….3.0 transformers v5.3.0 added `allow_all_kernels` parameter to `PreTrainedModel.get_init_context`. Accept *args/**kwargs so the patch works with both old and new transformers versions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
…lpers Tests cover: - Extra args/kwargs forwarding (transformers v5.3.0 allow_all_kernels) - Meta device filtering with no_hf_meta_device context manager - Patch installation on PreTrainedModel - Nested context manager behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
cd4b5d0 to
3b73476
Compare
Contributor
Author
|
/ok to test 3b73476 |
Consolidate tests into the existing test file rather than creating a separate test_model_init.py, since test_auto_model.py already tests other functions from model_init.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
Contributor
Author
|
/ok to test b8bdad7 |
akoumpa
previously approved these changes
Mar 10, 2026
Contributor
|
/ok to test b1afeb9 |
akoumpa
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
allow_all_kernelsparameter toPreTrainedModel.get_init_context, causing aTypeError: _patched_get_init_context() takes 4 positional arguments but 5 were given_patched_get_init_contextto accept*args, **kwargsand forward them, making the patch compatible with both old and new transformers versionsTest plan
🤖 Generated with Claude Code