Skip to content

Require peft>=0.17.0 and drop the target_parameters guards - #7640

Merged
albertvillanova merged 7 commits into
mainfrom
require-peft-0-17
Oct 16, 2026
Merged

albertvillanova merged 7 commits into
mainfrom
require-peft-0-17

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

This PR raises the peft floor from 0.13.0 (September 2024) to 0.17.0 (August 2025) and removes the guards that floor made necessary.

Part of #7644.

Depends on

Motivation

peft 0.13.0 is 24 months old, so under the criterion in #7116 it can be dropped without further justification. 0.17.0 is the newest release the same criterion allows today, since it is 14 months old and the rule does not require anything younger than 1 year.

LoraConfig.target_parameters was introduced in peft 0.17.0, so everything #7119 added to keep 0.13 through 0.16 working becomes dead at this floor.

Changes

  • Raise peft>=0.13.0 to >=0.17.0 in the peft extra and in dev
  • Drop the Version("0.17.0") <= lower bound from the reference-adapter guard in the DPO, GRPO, KTO and RLOO trainers, and the comment sentence explaining it
  • Pass target_parameters to LoraConfig directly in get_peft_config again, instead of only when set
  • Remove the require_peft_target_parameters test mark and restore @require_peft on the six tests that used it
  • Pin peft==0.17.0 in the minimum-versions CI job

The < Version("0.20.0") upper bound stays: it encodes peft#3340, fixed by peft#3350 in 0.20.0, and 0.17 to 0.19 are still supported.


Note

Medium Risk
Raises the supported PEFT floor (breaking for 0.13–0.16 installs) while RL trainer reference-adapter logic for 0.17–0.19 is unchanged aside from simplified version checks.

Overview
Raises the minimum PEFT dependency from >=0.13.0 to >=0.17.0 in pyproject.toml (peft extra and dev) and pins peft==0.17.0 in the minimum-versions CI job.

Because LoraConfig.target_parameters exists from 0.17 onward, the PR removes older-version shims: the require_peft_target_parameters pytest marker (MoE tests use @require_peft again), unconditional target_parameters in get_peft_config, and the lower bound on the reference-adapter warning in DPO, GRPO, KTO, and RLOO (still warns for PEFT < 0.20.0 when target_parameters is set).

Reviewed by Cursor Bugbot for commit 12027e1. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

Copy link
Copy Markdown

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.

@albertvillanova

albertvillanova commented Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

CI with minimum versions is red for TestAddFusedLMHeadLoss::test_forward_matches_reference_with_peft[prefix_tuning].

This PR requires marking that test as xfail:

#7646 is independent of the merge order and turns the resulting crash into a clear error across the trainers.

@qgallouedec

Copy link
Copy Markdown
Member

nice, thanks!

".[dev]" \
"accelerate==1.4.0" \
"datasets==4.7.0" \
"peft==0.17.0" \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@albertvillanova

Copy link
Copy Markdown
Member Author

The minimum-versions job is red on tests/test_distillation_trainer.py::TestDistillationTrainer::test_peft_prompt_learning_raises:

E       AssertionError: Regex pattern did not match.
E         Expected regex: 'Prompt-learning'
E         Actual message: 'Prefix tuning requires `peft>=0.18.0` when the model is loaded with a device map. Upgrade peft, or load the model with `device_map=None`. See https://github.com/huggingface/peft/issues/2821.'

The rest of the job is green (1 failed, 1997 passed), and the collection error from the previous run is gone.

https://github.com/huggingface/trl/actions/runs/38547934903/job/115798519219

Investigating.

@albertvillanova

albertvillanova commented Oct 14, 2026 •

Copy link
Copy Markdown
Member Author

Investigated: the failure is a bug on main, tracked in #7717 and fixed by

I will merge main and push here once that lands.

@albertvillanova
albertvillanova merged commit b6cbde9 into main Oct 16, 2026
11 checks passed
@albertvillanova
albertvillanova deleted the require-peft-0-17 branch October 16, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants