Repository navigation
Fix PEFT load report listing other adapters' weights as missing - #51199
Merged
hmellor merged 2 commits intoNov 25, 2026
Merged
Conversation
lucamotz
marked this pull request as ready for review
November 25, 2026 07:42
Contributor
Author
|
fyi @hmellor |
hmellor
enabled auto-merge
November 25, 2026 11:50
hmellor
added a commit
to BenjaminBossan/transformers
that referenced
this pull request
Nov 25, 2026
Matching on the PEFT type (e.g. "lora") made the load report list every other loaded adapter's weights as missing. Match the adapter name as a dot-separated key component instead, as in huggingface#51199, and drop the duplicate is_adapter_key definition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
hmellor
disabled auto-merge
November 25, 2026 11:54
hmellor
enabled auto-merge
November 25, 2026 11:54
|
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. |
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.
What does this PR do?
Since #43261,
is_adapter_keyinload_adaptermatches any key that contains the adapter name or the PEFT type ("lora"), so loading a second LoRA adapter reports the LoRA weights of every already-loaded adapter as MISSING ("newly initialized") and sizes the warmup for them, although they are untouched. It now matches only keys that have the adapter name as a dot-separated component, which also stopsadapter_1from matchingadapter_10's keys.Reproducer (on
mainit fails with 20lora_{A,B}.first.weightkeys; the documented per-taskload_adapterflow ofjinaai/jina-embeddings-v3-hflists 294 when loading a second task):For merging: #45682 re-declares the old
is_adapter_keyafter_load_pretrained_model; whichever of the two merges second should drop that copy, otherwise the false MISSING report comes back, because git does not flag that block (the new test fails on it).Validation:
test_peft_load_second_adapter_no_missing_keysfails onmainand passes here; otherwisetests/peft_integrationgives the same results as onmain.I used Claude Code for parts of this implementation.
Tests
tests/peft_integration31 passed, 16 skipped (3 accelerator, 13 slow).RUN_SLOW=1 tests/peft_integration:main39 passed / 5 failed, this PR 40 / 4. The only difference is the new test; the four rank-changing hotswap tests (*_lower_rank_works,*_higher_rank_works) fail on both.Real checkpoints
jinaai/jina-embeddings-v5-text-nanoasEuroBertModel(config switched toeurobert), its four task adapters loaded in turn:mainreports 168 / 336 / 504 false MISSING on loads 2–4, this PR 0. On both, every adapter's weights and embeddings are bit-identical to a model with only that adapter loaded (fp32 and bf16, GB10).Who can review?
Anyone in the community is free to review the PR once the tests have passed.