Repository navigation
Studio: skip xFormers when its torch requirement is unmet - #11847
Conversation
|
Reached Codex review convergence at oobabooga#300. |
|
Review record for #11847, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#96. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
…11847) Studio's Linux installer could pair xFormers 0.0.35 (torch>=2.10) with torch 2.6.0, which made every diffusers import fail. xFormers is now checked against its declared torch requirement from package metadata: an incompatible build is hidden before diffusers imports it (attention falls back to torch SDPA), the final Linux torch repair removes it even when torch is unchanged, and on-demand reinstalls are skipped while it is hidden. Compatible builds are kept.
…uirement check after the Linux repair The build check now runs whether or not this run moved torch, so an xFormers left mismatched by an earlier run is removed too, and a blocked uninstall is warned about instead of reported as removed.
Studio's Linux installer can pair xFormers 0.0.35 (
torch>=2.10) with torch 2.6.0+cu124, causing diffusers imports to fail (reported on Reddit and also #11545). This PR removes or hides incompatible xFormers so attention falls back to torch SDPA.This fixes the xFormers failure. Torch 2.6 hosts have a second, independent problem with Studio's current default diffusers main build: it imports
FqnToConfig, which torchao 0.14.0 lacks, and fails the same way with no xFormers installed at all. That is not addressed here, so the tests below use diffusers 0.40.0 (UNSLOTH_DIFFUSERS_MAIN=0), the version the reporter had.Cause
install.shpins torch through--overrides, bypassing xFormers' torch requirement. The existing Linux repair leaves the incompatible pair installed when torch is unchanged.Fix
Before and after
Fresh installs on an RTX 6000 Ada, using torch 2.6.0+cu124 and diffusers 0.40.0. Tested
unsloth/sdxl-turboat 512x512, one step.uv pip checkThe updated backend also loaded and generated from an existing broken environment without uninstalling xFormers. Explicitly selecting xFormers fell back successfully without downloading a replacement.
Tests
Scope
80c7ed26) on torch 2.6 needs its own fix. With this PR's installer and xFormers removed, that build still fails onFqnToConfig.