diff --git a/pkgs/development/python-modules/transformers/default.nix b/pkgs/development/python-modules/transformers/default.nix index 06508471a619..e9b312cf2c59 100644 --- a/pkgs/development/python-modules/transformers/default.nix +++ b/pkgs/development/python-modules/transformers/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildPythonPackage, fetchFromGitHub, @@ -68,6 +69,15 @@ buildPythonPackage rec { hash = "sha256-TQQ+w+EH/KWLE7iaaAHGxfE74hCiLXcqlIr1TIBFGvo="; }; + # torch.distributed is not available on darwin + # Fix submitted upstream in https://github.com/huggingface/transformers/pull/35133 + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace src/transformers/pytorch_utils.py \ + --replace-fail \ + 'if is_torch_greater_or_equal("2.5"):' \ + 'if False:' + ''; + build-system = [ setuptools ]; dependencies = [