Fix loading of legacy HuggingFace BERT checkpoints.#10631
Open
drivanov wants to merge 12 commits intopyg-team:masterfrom
Open
Fix loading of legacy HuggingFace BERT checkpoints.#10631drivanov wants to merge 12 commits intopyg-team:masterfrom
drivanov wants to merge 12 commits intopyg-team:masterfrom
Conversation
for more information, see https://pre-commit.ci
…tric into tokenizer # Conflicts: # torch_geometric/datasets/tag_dataset.py
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10631 +/- ##
==========================================
- Coverage 86.11% 85.53% -0.58%
==========================================
Files 496 510 +14
Lines 33655 35983 +2328
==========================================
+ Hits 28981 30779 +1798
- Misses 4674 5204 +530 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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.
Some legacy HuggingFace checkpoints such as
prajjwal1/bert-tinydo not contain aconfig.jsonwith themodel_typefield required by recent versions of Transformers.As a result,
AutoModelForSequenceClassification.from_pretrained()fails with:This PR adds a small fallback for such models by directly using BertForSequenceClassification, while keeping the default AutoModelForSequenceClassification path for all other models.