Unverified Commit 28a594a1 authored by Yt's avatar Yt Committed by GitHub
Browse files

python312Packages.transformers: fix darwin by skipping torch.distributed import (#362768)

parents c776d4b9 d842a192
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
{
  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 = [