Repository navigation
Require torch>=2.7.0 - #7752
Closed
albertvillanova wants to merge 2 commits into
Closed
Require torch>=2.7.0#7752albertvillanova wants to merge 2 commits into
albertvillanova wants to merge 2 commits into
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. |
Member
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR declares a torch floor of 2.7.0 and removes the fallbacks that existed for older torch.
Part of #7644. Alternative to #7642, which sets the floor at 2.6.0.
Motivation
TRL names no torch version at all, so the effective floor is whatever the stack enforces:
torch>=2.2from transformers 4.56.2. torch 2.7.0 was released on 2025-04-23, about 18 months ago, so it meets the 1-year criterion in #7116.2.7.0 instead of 2.6.0 because torch 2.6.0 (cu124) ships NVRTC 12.4.127, which switches Python's default text encoding to ASCII after the first runtime kernel compile (#7720). Training with TRL on torch 2.6.0 then fails when saving a checkpoint, as soon as the model card is generated. torch 2.7.0 ships NVRTC 12.6.77, which does not have the problem.
The branches below exist only to support torch versions below 2.7:
torch.acceleratorwas introduced in 2.6, with the older path hard-coding"cuda"FSDPModule,MixedPrecisionPolicyandfully_shardbecame public astorch.distributed.fsdpin 2.6, previouslytorch.distributed._composable.fsdpfully_shardacceptsignored_paramsfrom 2.7torch.get_device_moduleexists from 2.4,DTensoris public intorch.distributed.tensorfrom 2.5, andnn.Bufferexists from 2.5Changes
torch>=2.7.0to the project dependencies and pintorch==2.7.0in the minimum versions jobFSDPModule,MixedPrecisionPolicyandfully_shardfrom the publictorch.distributed.fsdpunconditionallyignored_paramstofully_shardunconditionallytorch.acceleratorunconditionally in activation offloading, the experimental online DPO trainer andtrl envDTensorfromtorch.distributed.tensorand checknn.Bufferunconditionally in activation offloadingThe
torch>=2.8.0guard stays, since it is above this floor.Note
Medium Risk
Raises the install floor and simplifies FSDP2/distributed paths; users on torch 2.2–2.6 can no longer install, but behavior for supported versions should be unchanged aside from always passing
ignored_paramson FSDP2.Overview
Requires PyTorch 2.7.0+ and drops compatibility shims for older torch.
pyproject.tomlnow liststorch>=2.7.0(documented as avoiding torch 2.6’s NVRTC-related ASCII text I/O bug during checkpoint/model-card writes). CI’s minimum-versions job pinstorch==2.7.0.Runtime code assumes modern torch APIs:
torch.accelerator/torch.get_device_modulein activation offloading, online DPO vLLM setup, andtrl env; publictorch.distributed.fsdpimports (FSDPModule,fully_shard,MixedPrecisionPolicy) withignored_paramsalways passed tofully_shard;DTensorfromtorch.distributed.tensorandnn.Bufferchecks without legacy import paths.Reviewed by Cursor Bugbot for commit 407a6d7. Bugbot is set up for automated code reviews on this repo. Configure here.