[Bugfix][CI/Build] Fix InternViT load crash on transformers v5 (missing all_tied_weights_keys) - #49679
Closed
nikhilkulkarni1755 wants to merge 1 commit into
Closed
[Bugfix][CI/Build] Fix InternViT load crash on transformers v5 (missing all_tied_weights_keys)#49679nikhilkulkarni1755 wants to merge 1 commit into
nikhilkulkarni1755 wants to merge 1 commit into
Conversation
…ng all_tied_weights_keys) test_intern_vit.py is skipped because loading the InternVisionModel reference crashes under transformers v5. Transformers v5 reads all_tied_weights_keys at modeling_utils.py:4736 but sets it only in PreTrainedModel.post_init. InternViT's remote InternVisionModel.__init__ never calls post_init, so the attribute is missing. Seed a safe empty default in the test conftest, matching what post_init would set. Remove the skip on test_intern_vit.py. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Nikhil Kulkarni <nikhilkulkarni1755@gmail.com>
Member
|
Sorry for missing this, but I prefer skipping the test because this is an upstream issue |
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.
Purpose
tests/models/multimodal/pooling/test_intern_vit.pyis skipped under transformers v5.Loading the
InternVisionModelreference crashes withAttributeError: 'InternVisionModel' object has no attribute 'all_tied_weights_keys'.Transformers v5 reads
all_tied_weights_keysatmodeling_utils.py:4736but sets it only inPreTrainedModel.post_init()(line 1394).InternViT's remote
InternVisionModel.__init__never callspost_init(), so the attribute is missing.Transformers is itself inconsistent here: line 4829 reads it defensively with
getattr(...), line 4736 does not.This seeds a safe empty default on
PreTrainedModelin the test conftest, matching whatpost_init()would set.It removes the skip on
test_intern_vit.py.No open PR addresses this.
Test Plan
Remove the skip.
Run
.venv/bin/python -m pytest tests/models/multimodal/pooling/test_intern_vit.py -v.Test Result
InternViT-300M passes with cosine similarity mean = 1.0 against the HF reference, no
AttributeError.Validated on an RTX 4060 (WSL2), transformers 5.9.0.
InternViT-6B needs more VRAM than that box has, so it runs in CI.
ruff-check,ruff-format, andmypypass.Notes
AI assistance was used.
This is a deterministic test-infrastructure fix, so model evals do not apply.
The root fix belongs upstream: make
modeling_utils.py:4736defensive like line 4829. I will file that with transformers separately.