Repository navigation
Require accelerate>=1.10.1 and drop the ParallelismConfig shim - #7643
Conversation
|
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. |
|
Thanks. Two more copies of the TP block still guard on 1.12.0: trl/trl/trainer/reward_trainer.py Lines 628 to 629 in 4f69d5e trl/trl/experimental/tpo/tpo_trainer.py Lines 466 to 467 in 4f69d5e The comment is wrong: |
qgallouedec
left a comment
There was a problem hiding this comment.
Feel free to merge when the above comment is addressed
|
Good catch, both are fixed. The three remaining |
This PR raises the accelerate floor from 1.4.0 (February 2025) to 1.10.1 (August 2025) and removes the compatibility code that floor required.
Part of #7644.
Motivation
accelerate 1.4.0 is 20 months old, so it falls under the second case of the criterion in #7116: weigh how hard the old version is to keep against who still depends on it. What it costs us is one monkeypatching shim and four version guards, and nothing pulls users towards an accelerate that old, since transformers only asks for
>=1.1.0. That makes it the "hard to keep, few users" case.1.10.1 is the newest release the 1-year rule allows today, at 14 months old.
Solution
_patch_transformers_parallelism_configexisted because transformers below 4.57.0 only importsParallelismConfigwhen accelerate is at least 1.10.1, andtyping.get_type_hintsthen raisesNameErroronTrainingArguments. Its own docstring gives the exit condition this PR meets. With the floor at 1.10.1 the guard can never be true, so the patch and its call at import time both go.The five
ParallelismConfig.tp_sizeguards, and the context-parallelism check in SFT, are unconditional for the same reason. Two of the five testedaccelerate>=1.12.0, althoughAccelerator.parallelism_confighas existed since 1.10.0, so under tensor parallelism on 1.10.1 to 1.11.x they were silently falling back totp_size = 1.Changes
accelerate>=1.4.0to>=1.10.1_patch_transformers_parallelism_configfromtrl/_compat.pyand the call that applied itparallelism_config.tp_sizewithout a version test in the DPO, KTO, SFT and reward trainers and in the experimental TPO trainer, keeping the five blocks identicalThe
accelerate>=1.11.0and>=1.12.0guards stay, since both are above this floor.Note
Low Risk
Dependency floor bump may break installs pinned to accelerate<1.10.1; runtime behavior is simplified, not redesigned.
Overview
Raises the minimum
acceleratedependency from 1.4.0 to 1.10.1 inpyproject.tomland pinsaccelerate==1.10.1in the CI minimum-versions job.With that floor, TRL drops legacy compatibility code: the
_patch_transformers_parallelism_configimport-time shim intrl/_compat.py(it papered over missingParallelismConfigon older accelerate/transformers pairs) is removed entirely.Several trainers (DPO, KTO, SFT, Reward, and experimental TPO) stop gating on accelerate version when reading
accelerator.parallelism_config.tp_sizefor token-count correction under tensor parallelism. SFT likewise always enforces the packing vs. context-parallelism conflict instead of only when accelerate ≥ 1.10.1. Unusedaccelerateimports tied to those guards are cleaned up. Guards for newer accelerate features (e.g. 1.12.0 sequence parallelism) are unchanged.Reviewed by Cursor Bugbot for commit 1d2ebd9. Bugbot is set up for automated code reviews on this repo. Configure here.