Repository navigation
Require torch>=2.6.0 and drop the pre-2.6 FSDP2 and accelerator fallbacks - #7642
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. A few things:
|
|
Thanks, all three confirmed and addressed:
|
|
Tracking issue: #7687; dedicated PR this PR depends on: |
|
CI is red: "Tests with minimum versions" (torch 2.6.0) fails with 45 failed tests: https://github.com/huggingface/trl/actions/runs/38386202899/job/115258503262 I am investigating. |
|
The following failure is tracked in #7692 and addressed in #7695: FAILED tests/test_grpo_trainer.py::TestGRPOTrainerVLM::test_train_vlm[trl-internal-testing/tiny-LlavaNextForConditionalGeneration] - ValueError: Image features and image tokens do not match: tokens: 1873, features 1872This PR depends on: |
# Conflicts: # pyproject.toml # trl/models/activation_offloading.py
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4cda0de. Configure here.
# Conflicts: # trl/models/activation_offloading.py

This PR declares a torch floor of 2.6.0 and removes the three fallbacks that existed for older torch.
Part of #7644.
Depends on
CheckpointError and wrong gradients in later training tests after a training error on the same test worker #7714: nothing to fix in TRL, it only follows another training failure, so it goes away with Prevent VLM policies from generating the image placeholder token in GRPO, RLOO and Distillation #7695corrected: the leak is in accelerate below 1.11 itself, so it survives Prevent VLM policies from generating the image placeholder token in GRPO, RLOO and Distillation #7695torch.compile(fullgraph=True)ofselective_log_softmax_and_entropyon torch 2.6 #7719Motivation
TRL names no torch version at all, so the effective floor is whatever the stack enforces:
torch>=2.2from transformers 4.56.2, since accelerate only asks for 2.0.0. torch 2.2 is 32 months old, so under the criterion in #7116 it can be dropped without further justification, and 2.6.0 is 20 months old, well clear of the 1-year rule. transformers on main already requirestorch>=2.6.Three branches exist only to support below that:
torch.acceleratorwas introduced in 2.6, with the older path hard-coding"cuda"FSDPModulebecame public astorch.distributed.fsdpin 2.6, previouslytorch.distributed._composable.fsdpMixedPrecisionPolicyandfully_shardHard-coding
"cuda"is the one with user-visible consequences: on torch below 2.6 an XPU or other accelerator was reported as CUDA.Changes
torch>=2.6.0to the project dependenciesFSDPModule,MixedPrecisionPolicyandfully_shardfrom the publictorch.distributed.fsdpunconditionallytorch.acceleratorunconditionally in the experimental online DPO trainertorch.acceleratorwithout a version check when listing Neuron devices intrl envThe
torch>=2.7.0and>=2.8.0guards stay, since both are above this floor.Note
Medium Risk
Dependency and distributed-training path changes (FSDP2, activation offloading, vLLM device detection) can break installs below 2.6 and affect non-CUDA accelerators if
torch.acceleratorbehavior differs from the old fallbacks.Overview
Raises the PyTorch floor to
>=2.6.0inpyproject.tomland pinstorch==2.6.0in the CI “minimum versions” job so supported stacks are exercised against that baseline.With that floor in place, the PR removes version-gated compatibility paths that targeted older PyTorch: vLLM setup in online DPO always uses
torch.acceleratorfor device type (no CUDA hard-code); FSDP2 code always importsFSDPModule,fully_shard, andMixedPrecisionPolicyfrom the publictorch.distributed.fsdpmodule; activation offloading always usestorch.accelerator/torch.get_device_module, importsDTensorfromtorch.distributed.tensor, and dropsis_torch_versionchecks and related doc caveats;trl envlists Neuron devices viatorch.acceleratorwithout a 2.6 guard.Reviewed by Cursor Bugbot for commit 0ed7eca. Bugbot is set up for automated code reviews on this repo. Configure here.