From b01a28912e287ae958b40b9dd0ea40f143270b91 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 27 Mar 2025 22:03:14 -0400 Subject: [PATCH] python312Packages.accelerate: fix tests on darwin If MPS devices are present, the library fails to handle the situation properly and fails when running a test case. Signed-off-by: Ihar Hrachyshka --- pkgs/development/python-modules/accelerate/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/accelerate/default.nix b/pkgs/development/python-modules/accelerate/default.nix index ed2243b96273..238c8c8045ff 100644 --- a/pkgs/development/python-modules/accelerate/default.nix +++ b/pkgs/development/python-modules/accelerate/default.nix @@ -3,6 +3,7 @@ lib, buildPythonPackage, fetchFromGitHub, + fetchpatch, pythonAtLeast, # buildInputs @@ -43,6 +44,14 @@ buildPythonPackage rec { hash = "sha256-J4eDm/PcyKK3256l6CAWUj4AWTB6neTKgxbBmul0BPE="; }; + patches = [ + # Fix tests on darwin: https://github.com/huggingface/accelerate/pull/3464 + (fetchpatch { + url = "https://github.com/huggingface/accelerate/commit/8b31a2fe2c6d0246fff9885fb1f8456fb560abc7.patch"; + hash = "sha256-Ek9Ou4Y/H1jt3qanf2g3HowBoTsN/bn4yV9O3ogcXMo="; + }) + ]; + buildInputs = [ llvmPackages.openmp ]; build-system = [ setuptools ];