huggingface / huggingface/peft

Warn when an explicit target_modules entry matches no module

Open
#3,693 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
21.7k
Forks
2.5k
Avg merge
4d 12h
Merged PRs (30d)
59

Description

## Proposal

In https://github.com/huggingface/peft/issues/3658#issuecomment-5538703779, @BenjaminBossan suggested warning when an explicit `target_modules` entry matches nothing (for example, `["q_proj", "v_proj", "foobar_proj"]`). The later discussion explicitly leaves this separate from #3658's per-layer coverage reporting.

Would you be happy for me to take that narrower warning as a separate contribution?

Proposed scope:

- For explicit target-name collections, report entries that match no eligible module when other entries do match, without changing which adapters are injected.
- Preserve the existing error when nothing matches.
- Leave regex decomposition, uneven layer coverage, and new status-reporting fields out of scope.
- Add small CPU-only tests for partial matches, complete matches, and the existing no-match error.

Before coding, I'd like to clarify whether entries matching modules that are deliberately excluded (`exclude_modules`, layer selection, or `modules_to_save`) should be omitted from the warning. My preference is to avoid warning for deliberate exclusions and focus on names absent from the model.

I checked current open PRs for `target_modules` and searches for the unmatched-target warning; I did not find an implementation of this separate request. I have not implemented a patch and will wait for approval and ownership confirmation.

AI assistance: Codex helped inspect the current matching code, search for overlap, and prepare this proposal. Any eventual AI-assisted patch will need human review and testing before submission, as required by the repository's contribution policy.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the current target_modules matching code and how excluded modules are handled. Add small CPU-only tests covering partial matches, complete matches, and the existing no-match error; done means unmatched explicit entries warn without changing adapter injection, while deliberate exclusions do not warn.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.