python3Packages.xformers: fix build with pytorch 2.13 (#559741)

This commit is contained in:
Yt
2026-09-04 17:17:22 +00:00
committed by GitHub

View File

@@ -3,6 +3,7 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# build-system
torch,
@@ -51,6 +52,16 @@ buildPythonPackage.override { stdenv = effectiveStdenv; } (finalAttrs: {
hash = "sha256-UqpRHLN0INpW6sA8DbQCSeL8uhS+IoW60UPVUIh1NY0=";
};
patches = [
# Fix `IndexError: list assignment index out of range` with torch >= 2.13
# https://github.com/facebookresearch/xformers/commit/f06b9a7b0db97a78913ca8dc1652468a0527dc80
(fetchpatch {
name = "xformers-fix-tests-pytorch-2.13.patch";
url = "https://github.com/facebookresearch/xformers/commit/f06b9a7b0db97a78913ca8dc1652468a0527dc80.patch";
hash = "sha256-QE3hmwXI3yJBgRWOHKoDUaEsFO+vuqV+DTMW7sjuURU=";
})
];
# ModuleNotFoundError: No module named 'xformers.components'
postPatch = ''
touch xformers/components/__init__.py