Skip to content

Require peft>=0.13.0 and drop the 0.12 version guards - #7102

Merged
qgallouedec merged 3 commits into
mainfrom
raise-peft-min-version
Sep 8, 2026
Merged

qgallouedec merged 3 commits into
mainfrom
raise-peft-min-version

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

I think it's high time to raise the PEFT floor from 0.8.0 (Jan 2024) to 0.13.0 (Sep 2024) and removes the version guards it makes dead.

  • autocast_adapter_dtype was added in PEFT 0.12.0. The Version(peft.__version__) >= Version("0.12") check appeared in 13 places (7 stable trainers, 5 experimental trainers, experimental/utils.py); all are now unconditional.
  • 0.13.0 rather than 0.12.0 so the floor is no older than 2 years.
  • Drops 9 imports that became unused (import peft, packaging.version.Version).

Note

Low Risk
Dependency floor bump may break installs pinned to older PEFT; training logic is simplified, not changed, for supported versions.

Overview
Raises the minimum PEFT dependency from 0.8.0 to 0.13.0 in pyproject.toml (both the peft extra and the bundled dev dependency set).

Because autocast_adapter_dtype is guaranteed on supported PEFT versions, TRL drops Version(peft.__version__) >= 0.12 checks across stable and experimental trainers (DPO, GRPO, SFT, KTO, RLOO, reward, distillation, BCO, CPO, ORPO, TPO, IW-OPD) and in experimental/utils.py. DeepSpeed ZeRO-3 + non-quantized PEFT still passes autocast_adapter_dtype=False; sharded QLoRA (4-bit) still disables autocast without a version gate.

Unused import peft (only needed for __version__) and packaging.version.Version imports tied to those guards are removed where applicable.

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

qgallouedec and others added 2 commits September 7, 2026 19:20
autocast_adapter_dtype was introduced in PEFT 0.12.0, so the floor makes
the guard dead code in all 13 places it appeared.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-07T19:28:52.161903Z 960a3f8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@bot-ci-comment

bot-ci-comment Bot commented Sep 7, 2026

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 960a3f8e31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

and not _is_quantized_model
and Version(peft.__version__) >= Version("0.12.0")
):
if args.deepspeed_plugin is not None and args.deepspeed_plugin.zero_stage == 3 and not _is_quantized_model:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the obsolete comment from every trainer

This makes the PEFT branch unconditional but leaves the 0.12 compatibility comment in BCO and the equivalent CPO, IW-OPD, ORPO, and TPO blocks, while deleting it from all stable trainer copies. These blocks now implement identical logic with different comments despite the repository's explicit requirement that duplicated trainer logic and comments remain aligned; remove the obsolete comment from the experimental copies as well.

AGENTS.md reference: AGENTS.md:L26-L35

Useful? React with 👍 / 👎.

@albertvillanova albertvillanova left a comment •

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.

LGTM, the change is correct and complete. Verified on 70261825.

One thing I would like us to settle separately: the criterion for raising a floor

Not a request to change anything here. It is about the rule the next one of these gets reviewed against.

Every floor bump in the repo so far has been feature-driven, with the required feature named in the title or body: datasets>=4.7.0 for the Json dtype (#5376), kernels>=0.14.0 for trust_remote_code, vllm>=0.11.0 (#5443). This PR adds a second, different rationale: the floor should be no older than two years. I think that rationale is defensible, and it happens to match SPEC 0, the Scientific Python standard that superseded NEP 29 and recommends dropping dependency releases older than 24 months. But it is not written down anywhere, and it is in direct tension with something I wrote myself: in #6447 I stated the opposite rule for bitsandbytes, "Do not bump the floor solely to drop this filter: wait for an independent reason to require 0.50.0."

Why this needs to be written down rather than settled per PR

  • Contributors cannot tell in advance whether the work is wanted. #6893 raises the bitsandbytes floor to drop a warning filter, which is exactly what #6447 says not to do, and it has been open for two weeks with no way to resolve it in either direction. That is not the contributor's mistake. There was nothing for them to read.
  • Any maintainer should be able to review one of these. Without a written rule, a floor bump needs a judgment call rather than a check, so it queues behind whoever is presumed to hold the position instead of being reviewable by whoever picks it up. A criterion turns the review into something verifiable from the diff.
  • The floor is a public promise. It is what users install against, so deciding it case by case means it drifts in whichever direction the most recent PR argued.

The two questions

  1. When is a bump justified at all? Feature needed, dead guards or shims removed, or calendar staleness. Whichever we pick, a reviewer should be able to check it mechanically instead of forming an opinion per PR.
  2. Guard or bump? Guards exist so the floor can stay low and newer features light up only on newer installs, so guarding should be the default and a bump should be argued on what it deletes.

I will open an issue with a concrete proposal for both questions so we can discuss it there.

@albertvillanova albertvillanova left a comment

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.

Opened #7116 for the criterion discussion.

@qgallouedec
qgallouedec merged commit 28b31c5 into main Sep 8, 2026
11 checks passed
@qgallouedec
qgallouedec deleted the raise-peft-min-version branch September 8, 2026 14:29
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