Repository navigation
FIX Raise an error when a PEFT method targets an unsupported layer type - #4015
Merged
BenjaminBossan merged 1 commit intoOct 20, 2026
Merged
BenjaminBossan merged 1 commit into
BenjaminBossan merged 1 commit into
Conversation
OSF skipped a target module that is not nn.Linear without an error, so the model had 0 trainable parameters. OSF now raises a TypeError, and the OSF docs example uses OPT with q_proj and v_proj. Lily and PEANuT raised NotImplementedError, GLoRA used its own wording, TinyLoRA raised a KeyError, and WaveFT with proportional_parameters said that no target module was found. They now use the shared wording. The new test_targeting_unknown_layer_type_raises runs for every MLP test case that sets target_modules. Resolves huggingface#3986 Co-Authored-By: Claude Opus 5.5 <[email protected]>
devYRPauli
added a commit
to devYRPauli/devYRPauli
that referenced
this pull request
Oct 19, 2026
Merged external pull requests: 137 across 36 projects, unchanged. Open: 60 -> 61 (huggingface/peft#4015). Upstream issues: 23 -> 22 (anomalyco/opencode#46868 closed as fixed on v2). No table row moved. The table still covers 84 merges across 13 projects, so the remainder is 53 across 23. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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. |
BenjaminBossan
approved these changes
Oct 20, 2026
BenjaminBossan
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR, it looks clean. Failing CI is unrelated.
devYRPauli
added a commit
to devYRPauli/devYRPauli
that referenced
this pull request
Oct 22, 2026
Merged external pull requests: 137 -> 143 across 36 -> 37 projects (huggingface/peft#4015, infiniflow/ragflow#20925, #20926, #20927, #20928, sqlfluff/sqlfluff#8620). Open: 62 -> 55. Upstream issues: 23 -> 20. Table rows that moved: RAGFlow 26 -> 30. PEFT is new at 22k stars, above the table's 10k floor, with 1 merge. The table now covers 89 merges across 14 projects, so the remainder is 54 across 23. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
PR description
Resolves #3986. Approval: #3986 (comment)
OSF skipped a target module that is not
nn.Linearand gave no error. With the gpt2 example from the OSF docs, the model had 0 trainable parameters, andloss.backward()failed.Changes:
nn.Linear. The error is aTypeErrorbecause the repo's ruff rule TRY004 rejects aValueErrorafter anisinstancecheck. BOFT, WaveFT, and TinyLoRA raise aTypeErrorfor the same case.facebook/opt-125mwithq_projandv_proj. I ran the example: 27,887,328 trainable parameters, and the backward pass runs.test_targeting_unknown_layer_type_raisesintest_custom_models.pyruns for every MLP entry that setstarget_modules. A newVanilla MLP 3 OSFentry setstarget_modules, so OSF is not skipped. The 2 existing OSF entries still test the default all-linear path.NotImplementedError. They now raise aValueErrorwith the sharedTarget module ... is not supportedwording.KeyError: 'lin0', because its layer index only holds the supported layer types. It now raises its existingTypeErrorfor an unsupported layer.proportional_parameters=Truesaid "No target modules found" when no target was a supported type. It now uses the same wording as VeRA, PVeRA, RandLora and FRoD:No layer types compatible with WaveFT were found.I did not change any
TypeError. LoHa and LoKr keep theirTypeErrorand wording. VeRA, PVeRA, RandLora, and FRoD check all targets before the first layer is created, so the test also accepts theirNo layer(s) types compatibleerror.Behavior change:
OSFConfig()withouttarget_moduleson gpt2 now raises an error. Before, it gave 0 trainable parameters. The gpt2 entry inTRANSFORMERS_MODELS_TO_OSF_TARGET_MODULES_MAPPINGpoints toConv1Dlayers. I did not remove it because the error names theConv1Dlayer.Tests:
pytest tests/test_custom_models.py -k test_targeting_unknown_layer_type_raises: 226 passed, 109 skipped. On main, 25 fail: GLoRA 6, TinyLoRA 6, Lily 5, PEANuT 5, WaveFT 2, OSF 1.pytest tests/test_osf.py: 8 passed. The 3 new cases fail on main.pytest tests/ --ignore=tests/test_seq_classifier.py -k "osf or lily or peanut or glora or waveft or tinylora or targeting_unknown": 4156 passed, 40 failed, 1305 skipped. The same 40 tests fail on main on my machine (macOS, CPU), all intest_training_*_gradient_checkpointingandtest_disable_adapterof the decoder and encoder-decoder tests. This PR adds no failures.make quality: passes.I used Claude Code CLI with Opus 5.5.